sql

package
v0.5.72 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map map[string]interface{}

Map type is an alias for map[string]interface{}

It implements native SQL driver interfaces and hence can be used for SQL json or jsonb types as a drop in replacement of golang native maps

func (Map) Interface

func (m Map) Interface() interface{}

Interface implements the nulls.nullable interface.

func (*Map) Scan

func (m *Map) Scan(src interface{}) error

Scan implements the sql.Scanner interface. It allows to read the map from the database value.

func (*Map) UnmarshalJSON

func (m *Map) UnmarshalJSON(b []byte) error

UnmarshalJSON will unmarshall JSON value into the map representation of this value.

func (Map) UnmarshalText

func (m Map) UnmarshalText(text []byte) error

UnmarshalText will unmarshall text value into the map representation of this value.

func (Map) Value

func (m Map) Value() (driver.Value, error)

Value implements the driver.Valuer interface. It allows to convert the map to a driver.value.

type Time added in v0.5.18

type Time struct {
	Time time.Time
}

Time is a wrapper for time.Time and implements Scanner and Valuer interfaces to support SQL driver

This wrapper adds support for unconventional data types likes string []byte as date types but also supports time.Time parsing

func (*Time) MarshalJSON added in v0.5.18

func (t *Time) 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 (*Time) MarshalText added in v0.5.18

func (t *Time) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface. The time is formatted in RFC 3339 format, with sub-second precision added if present.

func (*Time) Scan added in v0.5.18

func (t *Time) Scan(v interface{}) error

Scan implements the SQL driver scanner interface

func (*Time) UnmarshalJSON added in v0.5.18

func (t *Time) UnmarshalJSON(b []byte) error

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

func (*Time) UnmarshalText added in v0.5.18

func (t *Time) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.

func (Time) Value added in v0.5.18

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

Value implements the SQL driver valuer interface

Jump to

Keyboard shortcuts

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