Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 336 Bytes

null.md

File metadata and controls

26 lines (21 loc) · 336 Bytes

Null values

CREATE TABLE authors (
  id   SERIAL PRIMARY KEY,
  name text   NOT NULL,
  bio  text
);

For structs, null values are represented using the appropriate type from the database/sql package.

package db

import (
	"database/sql"
)

type Author struct {
	ID   int
	Name string
	Bio  sql.NullString
}