types

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDateFormat = errors.New(`invalid date format, it should be "YYYY-MM-DD"`)

ErrDateFormat :

Functions

This section is empty.

Types

type Boolean

type Boolean bool

Boolean :

func (*Boolean) Scan

func (x *Boolean) Scan(src interface{}) error

Scan :

type Date

type Date struct {
	Year, Month, Day int
}

Date :

func ParseDate

func ParseDate(str string) (Date, error)

ParseDate : parse string and convert to date

func (Date) DataType

DataType : sql data type of Date

func (*Date) IsZero

func (d *Date) IsZero() bool

IsZero : check date is zero value

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON :

func (Date) MarshalText

func (d Date) MarshalText() ([]byte, error)

MarshalText :

func (*Date) Scan

func (d *Date) Scan(it interface{}) error

Scan :

func (Date) String

func (d Date) String() string

String :

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON :

func (*Date) UnmarshalText

func (d *Date) UnmarshalText(b []byte) error

UnmarshalText :

func (Date) Value

func (d Date) Value() (driver.Value, error)

Value :

type Key

type Key struct {
	Namespace string
	Kind      string
	IntID     int64
	NameID    string
	Parent    *Key
}

Key :

func DecodeKey

func DecodeKey(encoded string) (*Key, error)

DecodeKey decodes a key from the opaque representation returned by Encode.

func IDKey

func IDKey(kind string, id int64, parent *Key) *Key

IDKey creates a new key with an ID. The supplied kind cannot be empty. The supplied parent must either be a complete key or nil. The namespace of the new key is empty.

func NameKey

func NameKey(kind, name string, parent *Key) *Key

NameKey creates a new key with a name. The supplied kind cannot be empty. The supplied parent must either be a complete key or nil. The namespace of the new key is empty.

func NewIDKey

func NewIDKey(kind string, parent *Key) *Key

NewIDKey :

func NewNameKey

func NewNameKey(kind string, parent *Key) *Key

NewNameKey :

func ParseKey

func ParseKey(value string) (*Key, error)

ParseKey :

func (*Key) Clone added in v1.0.1

func (k *Key) Clone() *Key

Clone :

func (Key) DataType

func (k Key) DataType(t sqldriver.Info, sf reflext.StructFielder) columns.Column

DataType :

func (Key) Encode

func (k Key) Encode() string

Encode returns an opaque representation of the key suitable for use in HTML and URLs. This is compatible with the Python and Java runtimes.

func (*Key) Equal

func (k *Key) Equal(o *Key) bool

Equal reports whether two keys are equal. Two keys are equal if they are both nil, or if their kinds, IDs, names, namespaces and parents are equal.

func (*Key) GobDecode

func (k *Key) GobDecode(buf []byte) error

GobDecode unmarshals a sequence of bytes using an encoding/gob.Decoder.

func (Key) GobEncode

func (k Key) GobEncode() ([]byte, error)

GobEncode marshals the key into a sequence of bytes using an encoding/gob.Encoder.

func (Key) ID

func (k Key) ID() string

ID :

func (*Key) Incomplete

func (k *Key) Incomplete() bool

Incomplete : is a safe method to check key is nil or empty

func (Key) MarshalBSONValue

func (k Key) MarshalBSONValue() (bsontype.Type, []byte, error)

MarshalBSONValue :

func (Key) MarshalBinary

func (k Key) MarshalBinary() ([]byte, error)

MarshalBinary :

func (Key) MarshalJSON

func (k Key) MarshalJSON() ([]byte, error)

MarshalJSON :

func (Key) MarshalJSONB

func (k Key) MarshalJSONB() ([]byte, error)

MarshalJSONB :

func (Key) MarshalText

func (k Key) MarshalText() ([]byte, error)

MarshalText :

func (*Key) Root

func (k *Key) Root() *Key

Root :

func (*Key) Scan

func (k *Key) Scan(it interface{}) error

Scan :

func (Key) String

func (k Key) String() string

String returns a string representation of the key.

func (*Key) UnmarshalBSONValue

func (k *Key) UnmarshalBSONValue(t bsontype.Type, b []byte) error

UnmarshalBSONValue :

func (*Key) UnmarshalBinary

func (k *Key) UnmarshalBinary(b []byte) error

UnmarshalBinary :

func (*Key) UnmarshalJSON

func (k *Key) UnmarshalJSON(b []byte) error

UnmarshalJSON :

func (*Key) UnmarshalJSONB

func (k *Key) UnmarshalJSONB(b []byte) error

UnmarshalJSONB :

func (*Key) UnmarshalText added in v1.0.2

func (k *Key) UnmarshalText(b []byte) error

UnmarshalText :

func (Key) Value

func (k Key) Value() (driver.Value, error)

Value :

type Set added in v1.0.2

type Set []string

Set : sql data type of `SET`

func (Set) DataType added in v1.0.2

func (s Set) DataType(_ sqldriver.Info, sf reflext.StructFielder) columns.Column

DataType :

func (*Set) Scan added in v1.0.2

func (s *Set) Scan(it interface{}) error

Scan :

func (Set) Value added in v1.0.2

func (s Set) Value() (driver.Value, error)

Value :

Jump to

Keyboard shortcuts

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