Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 446 Bytes

time.md

File metadata and controls

28 lines (22 loc) · 446 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 from database/sql is used.

package db

import (
	"time"
	"database/sql"
)

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