types

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 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

func Float32(f float32) *float32

Float32 will return the pointer of the float32

func Float64

func Float64(f float64) *float64

Float64 will return the pointer of the float64

func Int

func Int(i int) *int

Int will return the pointer of the int

func Int64

func Int64(i int64) *int64

Int64 will return the pointer of the int64

func String

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

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

func (*Duration) Scan

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

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

type Timestamp struct {
	time.Time
}

func (Timestamp) MarshalBSONValue

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

func (Timestamp) MarshalJSON

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

func (*Timestamp) Scan

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

func (*Timestamp) UnmarshalBSONValue

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

func (*Timestamp) UnmarshalJSON

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

func (Timestamp) Value

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

type URL

type URL struct {
	*url.URL
}

func (URL) MarshalJSON

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

func (*URL) Scan

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

func (*URL) UnmarshalJSON

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

func (URL) Value

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