values

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 25

Documentation

Index

Constants

View Source
const (
	BytesEmptyJson = "null"
)
View Source
const MaxBitwiseUnit = 32
View Source
const MessageErrorCodeDefault int = 9999

Variables

This section is empty.

Functions

func ParseFloat64 added in v1.1.0

func ParseFloat64(v any) (r float64)

func ParseInt64 added in v1.1.0

func ParseInt64(v any) int64

func ParseString added in v1.1.0

func ParseString(v any) (r string)

Types

type Attach

type Attach string

func (*Attach) GetInt32 added in v1.1.0

func (a *Attach) GetInt32() (r int32)

func (*Attach) GetInt64 added in v1.1.0

func (a *Attach) GetInt64() (r int64)

func (*Attach) GetString added in v1.1.0

func (a *Attach) GetString() (r string)

func (*Attach) Marshal

func (a *Attach) Marshal(v interface{}) error

Marshal 将一个对象放入Attach TODO len(*a) == 0

func (*Attach) MarshalJSON

func (a *Attach) MarshalJSON() ([]byte, error)

func (*Attach) Unmarshal

func (a *Attach) Unmarshal(i interface{}) error

Unmarshal 使用i解析Attach

func (*Attach) UnmarshalJSON

func (a *Attach) UnmarshalJSON(b2 []byte) error

type Bitwise

type Bitwise []Byte

func (*Bitwise) Delete

func (m *Bitwise) Delete(bit int)

Delete bit位设置为0

func (*Bitwise) Has

func (m *Bitwise) Has(bit int) bool

Has bit位是否设置值

func (*Bitwise) Set

func (m *Bitwise) Set(bit int)

Set bit位设置为1

type Byte added in v0.0.2

type Byte uint32

func (*Byte) Delete added in v0.0.2

func (m *Byte) Delete(bit int)

Delete bit位设置为0

func (*Byte) Has added in v0.0.2

func (m *Byte) Has(bit int) (r bool)

Has bit位是否设置值

func (*Byte) Set added in v0.0.2

func (m *Byte) Set(bit int)

Set bit位设置为1

type Bytes added in v0.0.2

type Bytes []byte

func (*Bytes) Marshal added in v0.0.2

func (b *Bytes) Marshal(v interface{}) error

func (*Bytes) MarshalJSON added in v0.0.2

func (b *Bytes) MarshalJSON() ([]byte, error)

func (*Bytes) Unmarshal added in v0.0.2

func (b *Bytes) Unmarshal(i interface{}) error

func (*Bytes) UnmarshalJSON added in v0.0.2

func (b *Bytes) UnmarshalJSON(v []byte) error

type Message

type Message struct {
	Code int   `json:"code"`
	Data Bytes `json:"data"`
}

func Error

func Error(err any) (r *Message)

func Errorf

func Errorf(code int, format any, args ...any) (r *Message)

func Parse

func Parse(v any) *Message

func (*Message) Error

func (this *Message) Error() string

func (*Message) Format added in v0.0.4

func (this *Message) Format(code int, format any, args ...any)

Format 格式化一个错误,必定产生错误码

func (*Message) Marshal added in v0.0.2

func (this *Message) Marshal(v interface{}) error

func (*Message) Parse

func (this *Message) Parse(v interface{}) *Message

func (*Message) String added in v0.0.2

func (this *Message) String() string

func (*Message) Unmarshal added in v0.0.2

func (this *Message) Unmarshal(i interface{}) error

Unmarshal 如果是一个错误信息 应当单独处理

type Values

type Values map[string]any

func (Values) Clone added in v1.1.0

func (vs Values) Clone() Values

func (Values) Get

func (vs Values) Get(k string) any

func (Values) GetFloat32

func (vs Values) GetFloat32(k string) float32

func (Values) GetFloat64

func (vs Values) GetFloat64(k string) (r float64)

func (Values) GetInt

func (vs Values) GetInt(k string) int

func (Values) GetInt32

func (vs Values) GetInt32(k string) int32

func (Values) GetInt64

func (vs Values) GetInt64(k string) int64

func (Values) GetString

func (vs Values) GetString(k string) (r string)

func (Values) Has

func (vs Values) Has(k string) bool

func (Values) Key added in v1.1.0

func (vs Values) Key(k any) string

func (Values) Marshal added in v1.1.0

func (vs Values) Marshal(k string, v any) (r any, err error)

func (Values) Merge added in v1.1.0

func (vs Values) Merge(from Values, replace bool)

func (Values) Range added in v1.1.0

func (vs Values) Range(f func(k string, v any) bool)

func (Values) Set

func (vs Values) Set(k string, v any) any

Set 保存数据,除了字符串和数字之外,一律转换成json字符串,Get时需要留意使用Unmarshal

func (Values) Unmarshal added in v1.1.0

func (vs Values) Unmarshal(k string, v any) error

Jump to

Keyboard shortcuts

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