values

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 35

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func IsBasicType added in v1.4.0

func IsBasicType(v interface{}) bool

func ParseFloat32 added in v1.5.3

func ParseFloat32(v any) (r float32)

func ParseFloat64 added in v1.1.0

func ParseFloat64(v any) float64

func ParseInt32 added in v1.2.0

func ParseInt32(v any) int32

func ParseInt64 added in v1.1.0

func ParseInt64(v any) int64

func ParseString added in v1.1.0

func ParseString(v any) string

func Sprintf added in v1.2.0

func Sprintf(format any, args ...any) (text 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

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 any) 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 any) error

func (*Bytes) UnmarshalJSON added in v0.0.2

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

type Message

type Message struct {
	Code int32 `json:"code"`
	Data any   `json:"data"`
}

func Error

func Error(err any) (r *Message)

func Errorf

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

func Parse

func Parse(v any) *Message

func (*Message) Error

func (this *Message) Error() string

func (*Message) Errorf

func (this *Message) Errorf(code int32, format any, args ...any)

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

func (*Message) Parse

func (this *Message) Parse(v any) *Message

func (*Message) String added in v0.0.2

func (this *Message) String() string

type Metadata added in v1.2.0

type Metadata map[string]string

func (Metadata) Clone added in v1.2.0

func (meta Metadata) Clone() Metadata

func (Metadata) Get added in v1.2.0

func (meta Metadata) Get(keys ...string) (string, bool)

func (Metadata) GetFloat32 added in v1.2.0

func (meta Metadata) GetFloat32(k string) float32

func (Metadata) GetFloat64 added in v1.2.0

func (meta Metadata) GetFloat64(k string) (r float64)

func (Metadata) GetInt added in v1.2.0

func (meta Metadata) GetInt(k string) int

func (Metadata) GetInt32 added in v1.2.0

func (meta Metadata) GetInt32(k string) int32

func (Metadata) GetInt64 added in v1.2.0

func (meta Metadata) GetInt64(k string) int64

func (Metadata) GetString added in v1.2.0

func (meta Metadata) GetString(k string) (r string)

func (Metadata) GetUint added in v1.2.0

func (meta Metadata) GetUint(k string) uint

func (Metadata) GetUint64 added in v1.2.0

func (meta Metadata) GetUint64(k string) uint64

func (Metadata) GetUit32 added in v1.2.0

func (meta Metadata) GetUit32(k string) uint32

func (Metadata) Set added in v1.2.0

func (meta Metadata) Set(k string, v any)

type Request added in v1.4.0

type Request struct {
	Code int32 `json:"code"`
	Data Bytes `json:"data"`
}

func (*Request) Error added in v1.4.0

func (this *Request) Error() (r string)

func (*Request) Marshal added in v1.4.0

func (this *Request) Marshal(v any) error

func (*Request) Unmarshal added in v1.4.0

func (this *Request) Unmarshal(i interface{}) (err 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) MarshalJSON added in v1.4.0

func (vs Values) MarshalJSON() ([]byte, 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, i any) error

Jump to

Keyboard shortcuts

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