Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 468 Bytes

File metadata and controls

30 lines (23 loc) · 468 Bytes

Time

CREATE TABLE authors (
  id         SERIAL    PRIMARY KEY,
  created_at timestamp NOT NULL DEFAULT NOW(),
  updated_at timestamp
);

All PostgreSQL time and date types are returned as time.Time structs. For null time or date values, the NullTime type is used from the github.com/lib/pq package.

package db

import (
	"time"

	"github.com/lib/pq"
)

type Author struct {
	ID        int
	CreatedAt time.Time
	UpdatedAt pq.NullTime
}