sqlite

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sqlite have some helpers and types for working with sqlite.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSQLTimeUnmarshallType = errors.New("incompatible type for SQLTime")
)

Functions

This section is empty.

Types

type SQLTime

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

SQLTime will represent an time.Time for sqlite with milliseconds support.

func SQLTimeFromTime

func SQLTimeFromTime(t time.Time) SQLTime

SQLTimeFromTime will create a SQLTime from time.Time. It converts the time to time.UTC().

func (SQLTime) MarshalJSON

func (t SQLTime) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. The time is a quoted string in RFC 3339 format, with sub-second precision added if present.

func (*SQLTime) Scan

func (t *SQLTime) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (*SQLTime) UnmarshalJSON

func (t *SQLTime) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format.

func (SQLTime) Value

func (t SQLTime) Value() (driver.Value, error)

Value implements the driver driver.Valuer interface.

Jump to

Keyboard shortcuts

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