sqltype

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2018 License: MIT Imports: 3 Imported by: 0

README

What is it?

Build Status

The sqltype package is a set of types that embraces the sql.Scanner interface from database/sql to other types, e.g. time.Time with sqltype.NullTime and time.Duration with sqltype.NullDuration.

Prior art

Parts of this are taken from the lib/pq library, e.g. the sqltype.NullTime has been take from here.

License

MIT. See LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NullDuration

type NullDuration struct {
	Duration time.Duration
	Valid    bool // Valid is true if Duration is not NULL
}

NullDuration represents a time.Duration that may be null. NullDuration implements the sql.Scanner interface so it can be used as a scan destination, similar to sql.NullString.

func (*NullDuration) Scan

func (nd *NullDuration) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullDuration) Value

func (nd NullDuration) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

NullTime represents a time.Time that may be null. NullTime implements the sql.Scanner interface so it can be used as a scan destination, similar to sql.NullString.

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL