types

package
v0.0.47 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 12 Imported by: 0

README

Introduction

There are a set of customized types for json.Unmarshal or sql Scan uses, and these types can be used to instead of using basic types.

Usages

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidKey = uerror.New(100, "invalid key")
)

Functions

func Decrypt

func Decrypt(d, k []byte) ([]byte, error)

func Float32 added in v0.0.47

func Float32(f float32) *float32

Float32 will return the pointer of the float32

func Float64 added in v0.0.47

func Float64(f float64) *float64

Float64 will return the pointer of the float64

func Int added in v0.0.47

func Int(i int) *int

Int will return the pointer of the int

func Int64 added in v0.0.47

func Int64(i int64) *int64

Int64 will return the pointer of the int64

func String added in v0.0.47

func String(s string) *string

String will return the pointer of the string

Types

type Duration

type Duration struct {
	time.Duration
}

Duration can be used for "ns", "us" (or "µs"), "ms", "s", "m", "h" suffixs

func (Duration) MarshalJSON added in v0.0.46

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

func (*Duration) Scan added in v0.0.46

func (d *Duration) Scan(src interface{}) error

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON for implementing the Unmarshaler interface

func (Duration) Value added in v0.0.46

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

type EData

type EData struct {
	// contains filtered or unexported fields
}

EData for encrypted data

func NewEData

func NewEData(s, k string) EData

NewEData the constructor

func (*EData) Scan

func (e *EData) Scan(src interface{}) error

Scan for implementing the sql.Scanner interface

func (EData) String

func (e EData) String() string

func (EData) Value

func (e EData) Value() (driver.Value, error)

Value for implementing the driver.Valuer interface

type Timestamp added in v0.0.2

type Timestamp struct {
	time.Time
}

func (Timestamp) MarshalBSONValue added in v0.0.44

func (t Timestamp) MarshalBSONValue() (bsontype.Type, []byte, error)

func (Timestamp) MarshalJSON added in v0.0.2

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

func (*Timestamp) Scan added in v0.0.2

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

func (*Timestamp) UnmarshalBSONValue added in v0.0.44

func (t *Timestamp) UnmarshalBSONValue(bType bsontype.Type, data []byte) error

func (*Timestamp) UnmarshalJSON added in v0.0.16

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

func (Timestamp) Value added in v0.0.2

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

type URL added in v0.0.40

type URL struct {
	*url.URL
}

func (URL) MarshalJSON added in v0.0.40

func (u URL) MarshalJSON() ([]byte, error)

func (*URL) Scan added in v0.0.40

func (u *URL) Scan(src interface{}) error

func (*URL) UnmarshalJSON added in v0.0.40

func (u *URL) UnmarshalJSON(data []byte) error

func (URL) Value added in v0.0.40

func (u URL) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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