types

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UseLocalTimeZone  = true                  //是否使用本地时区
	DefaultTimeFormat = "2006-01-02 15:04:05" //默认时间格式化字符串
)
View Source
var Base64Encoding = base64.StdEncoding

default base64 encoder

View Source
var NilObjectID = primitive.NilObjectID

Functions

func Bool

func Bool(b bool) *bool

func False

func False() *bool

func Int

func Int(n int) *int

func String

func String(s string) *string

func True

func True() *bool

func Uint

func Uint(u uint) *uint

Types

type A

type A []interface{}

Array

type Bytes added in v0.0.5

type Bytes []byte

func NewBytes added in v0.0.5

func NewBytes(bss ...[]byte) Bytes

bss 可以是 nil 等同于 Bytes(bs)

func (Bytes) Base64 added in v0.0.5

func (b Bytes) Base64(encodings ...*base64.Encoding) string

func (Bytes) Bytes added in v0.0.5

func (b Bytes) Bytes() []byte

等同于 []byte(h)

func (*Bytes) FromBase64 added in v0.0.5

func (b *Bytes) FromBase64(s string, encodings ...*base64.Encoding) error

func (*Bytes) FromHex added in v0.0.5

func (b *Bytes) FromHex(s string) error

func (*Bytes) FromString added in v0.0.5

func (b *Bytes) FromString(s string)

func (Bytes) Hex added in v0.0.5

func (b Bytes) Hex() string

func (Bytes) String added in v0.0.5

func (b Bytes) String() string

type D

type D []E

Doc

func (D) Append added in v0.0.8

func (d D) Append(key string, val interface{}) D

func (D) Map

func (d D) Map() M

type E

type E struct {
	Key   string
	Value interface{}
}

Elem

type M

type M map[string]interface{}

Map

func (M) String added in v0.0.6

func (m M) String(key string) string

type Map added in v0.0.8

type Map map[string]interface{}

func (Map) Bool added in v0.0.8

func (m Map) Bool(key string) bool

func (Map) Int added in v0.0.8

func (m Map) Int(key string) int

func (Map) List added in v0.0.8

func (m Map) List(key string) []interface{}

func (Map) Map added in v0.0.8

func (m Map) Map(key string) Map

func (Map) String added in v0.0.8

func (m Map) String(key string) string

type ObjectID

type ObjectID = primitive.ObjectID

func NewObjectID

func NewObjectID() ObjectID

func ObjectIDFrom added in v0.0.6

func ObjectIDFrom(i interface{}) (ObjectID, error)

func ObjectIDFromHex

func ObjectIDFromHex(s string) (ObjectID, error)

func ObjectIDSliceFrom added in v0.0.8

func ObjectIDSliceFrom(i interface{}) ([]ObjectID, error)

type Time added in v0.0.8

type Time struct {
	time.Time
}

Time extension time

func Now added in v0.0.8

func Now() Time

Now returns the current local time.

func (Time) MarshalBSON added in v0.0.8

func (t Time) MarshalBSON() ([]byte, error)

MarshalBSON marshal bson

func (Time) MarshalBSONValue added in v0.0.8

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

MarshalBSONValue marshal bson value

func (Time) MarshalJSON added in v0.0.8

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

MarshalJSON marshal json

func (*Time) UnmarshalBSON added in v0.0.8

func (t *Time) UnmarshalBSON(data []byte) error

UnmarshalBSON unmarshal bson

func (*Time) UnmarshalBSONValue added in v0.0.8

func (t *Time) UnmarshalBSONValue(btype bsontype.Type, data []byte) error

func (*Time) UnmarshalJSON added in v0.0.8

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

UnmarshalJSON unmarshal json

Jump to

Keyboard shortcuts

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