Documentation
¶
Overview ¶
Package sqltypes extends database/sql.Null* types, and types that implement sql.Scanner and driver.Value.
// NullJSON example
type Point struct {
X, Y int
}
// insert
_, err := db.Exec(`insert into doc(point) values ($1)`, NullJSON{&Point{1, 2}})
// select
var dest Point
err := db.QueryRow(`select point from doc limit 1`).Scan(&NullJSON{&dest})
fmt.Printf("%+v", dest) // {X:1 Y:2}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NullJSON ¶
type NullJSON struct {
Interface interface{}
}
NullJSON represents a JSON serializable interface that may be null.
type PgDateRange ¶
PgDateRange defines a PostgreSQL daterange type.
func (*PgDateRange) Scan ¶
func (a *PgDateRange) Scan(value interface{}) error
Scan reads a value as a PostgreSQL daterange and populates a PgDateRange.
Click to show internal directories.
Click to hide internal directories.