datatypes

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAddr

type IPAddr struct {
	IPNet *net.IPNet
	Valid bool
}

func (*IPAddr) FromText

func (dst *IPAddr) FromText(src string) error

func (IPAddr) MarshalJSON

func (src IPAddr) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*IPAddr) Scan

func (dst *IPAddr) Scan(src interface{}) error

func (*IPAddr) UnmarshalJSON

func (dst *IPAddr) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON parse JSON valus and set into field

func (IPAddr) Value

func (p IPAddr) Value() (driver.Value, error)

type NullBool

type NullBool bool

func (*NullBool) FromString

func (dst *NullBool) FromString(src string) error

func (NullBool) MarshalJSON

func (src NullBool) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*NullBool) Scan

func (dst *NullBool) Scan(src interface{}) error

func (*NullBool) UnmarshalJSON

func (dst *NullBool) UnmarshalJSON(b []byte) error

UnmarshalJSON parse JSON valus and set into field

func (NullBool) Value

func (src NullBool) Value() (driver.Value, error)

type NullFloat32

type NullFloat32 struct {
	Float float32
	Valid bool
}

func NewNullFloat32 added in v0.0.7

func NewNullFloat32(val float32) NullFloat32

func (*NullFloat32) FromString

func (dst *NullFloat32) FromString(src string) error

func (NullFloat32) MarshalJSON

func (src NullFloat32) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*NullFloat32) Scan

func (dst *NullFloat32) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*NullFloat32) SetValue added in v0.0.4

func (ns *NullFloat32) SetValue(val float32)

func (*NullFloat32) UnmarshalJSON

func (dst *NullFloat32) UnmarshalJSON(b []byte) error

UnmarshalJSON parse JSON valus and set into field

func (NullFloat32) Value

func (src NullFloat32) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type NullFloat64

type NullFloat64 struct {
	Float float64
	Valid bool
}

func NewNullFloat64 added in v0.0.7

func NewNullFloat64(val float64) NullFloat64

func (*NullFloat64) FromString

func (dst *NullFloat64) FromString(src string) error

func (NullFloat64) MarshalJSON

func (src NullFloat64) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*NullFloat64) Scan

func (dst *NullFloat64) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*NullFloat64) SetValue added in v0.0.4

func (ns *NullFloat64) SetValue(val float64)

func (*NullFloat64) UnmarshalJSON

func (dst *NullFloat64) UnmarshalJSON(b []byte) error

UnmarshalJSON parse JSON valus and set into field

func (NullFloat64) Value

func (src NullFloat64) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type NullInt16

type NullInt16 struct {
	Int   int16
	Valid bool
}

func NewNullInt16 added in v0.0.7

func NewNullInt16(val int16) NullInt16

func (*NullInt16) FromString

func (dst *NullInt16) FromString(src string) error

func (NullInt16) MarshalJSON

func (src NullInt16) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*NullInt16) Scan

func (dst *NullInt16) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*NullInt16) SetValue added in v0.0.4

func (ns *NullInt16) SetValue(val int16)

func (*NullInt16) UnmarshalJSON

func (dst *NullInt16) UnmarshalJSON(b []byte) error

UnmarshalJSON parse JSON valus and set into field

func (NullInt16) Value

func (src NullInt16) Value() (driver.Value, error)

type NullInt32

type NullInt32 struct {
	Int   int32
	Valid bool
}

func NewNullInt32 added in v0.0.7

func NewNullInt32(val int) NullInt32

func (*NullInt32) FromString

func (dst *NullInt32) FromString(src string) error

func (NullInt32) MarshalJSON

func (src NullInt32) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*NullInt32) Scan

func (dst *NullInt32) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*NullInt32) SetValue added in v0.0.4

func (ns *NullInt32) SetValue(val int32)

func (*NullInt32) UnmarshalJSON

func (dst *NullInt32) UnmarshalJSON(b []byte) error

UnmarshalJSON parse JSON valus and set into field

func (NullInt32) Value

func (src NullInt32) Value() (driver.Value, error)

type NullInt64

type NullInt64 struct {
	Int   int64
	Valid bool
}

func NewNullInt64 added in v0.0.7

func NewNullInt64(val int64) NullInt64

func (*NullInt64) FromString

func (dst *NullInt64) FromString(src string) error

func (NullInt64) MarshalJSON

func (src NullInt64) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*NullInt64) Scan

func (dst *NullInt64) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*NullInt64) SetValue added in v0.0.4

func (ns *NullInt64) SetValue(val int64)

func (*NullInt64) UnmarshalJSON

func (dst *NullInt64) UnmarshalJSON(b []byte) error

UnmarshalJSON parse JSON valus and set into field

func (NullInt64) Value

func (src NullInt64) Value() (driver.Value, error)

type NullString

type NullString struct {
	String string
	Valid  bool // Valid is true if string is not NULL
}

NullString to scan nil string values from database

func NewNullString added in v0.0.7

func NewNullString(val string) NullString

func (NullString) MarshalJSON

func (ns NullString) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this String is null.

func (*NullString) Scan

func (ns *NullString) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*NullString) SetValue added in v0.0.4

func (ns *NullString) SetValue(val string)

func (*NullString) UnmarshalJSON

func (ns *NullString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports string and null input. Blank string input does not produce a null String. It also supports unmarshalling a sql.NullString.

func (NullString) Value

func (ns NullString) 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

func NewNullTime added in v0.0.7

func NewNullTime(val time.Time) NullTime

func (NullTime) MarshalJSON

func (nt NullTime) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*NullTime) Scan

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

Scan implements the Scanner interface.

func (*NullTime) SetValue added in v0.0.4

func (ns *NullTime) SetValue(val time.Time)

func (*NullTime) String

func (nt *NullTime) String() string

func (*NullTime) UnmarshalJSON

func (nt *NullTime) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON parse JSON valus and set into field

func (NullTime) Value

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

Value implements the driver Valuer interface.

type OnlyTime

type OnlyTime time.Time

OnlyTime represents only time portion of datetime

func (OnlyTime) MarshalJSON

func (ot OnlyTime) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*OnlyTime) Scan

func (ot *OnlyTime) Scan(value interface{}) error

Scan - Implementation of scanner for database/sql

func (*OnlyTime) String

func (ot *OnlyTime) String() string

func (*OnlyTime) UnmarshalJSON

func (ot *OnlyTime) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON parse JSON valus and set into field

func (OnlyTime) Value

func (ot OnlyTime) Value() (driver.Value, error)

Value - Implementation of valuer for database/sql

type UnixTime

type UnixTime struct {
	Utime int64
	Valid bool // Valid is true if Time is not NULL
}

UnixTime to scan time values from database to unix timestamp

func NewUnixTime

func NewUnixTime(t time.Time) UnixTime

NewUnixTime create new UnixTime struct for given time.Time

func (*UnixTime) Format

func (nt *UnixTime) Format(layout string) string

Format formats time to given layout

func (UnixTime) MarshalJSON

func (nt UnixTime) MarshalJSON() ([]byte, error)

MarshalJSON convert field value to JSON

func (*UnixTime) Scan

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

Scan implements the Scanner interface.

func (*UnixTime) String

func (nt *UnixTime) String() string

func (*UnixTime) Time

func (nt *UnixTime) Time() time.Time

Time returns value of time

func (*UnixTime) UnmarshalJSON

func (nt *UnixTime) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON parse JSON valus and set into field

It is setter, so *UnixTime is required

func (UnixTime) Value

func (nt UnixTime) 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