mvar

package
v0.0.0-...-961d35a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String(value interface{}) string

String 将任意类型转换为字符串

Types

type Var

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

Var 是一个通用变量类型的实现

func New

func New(value interface{}, safe ...bool) *Var

New 创建并返回一个新的 Var safe 参数用于指定是否启用线程安全,默认为 false

func (*Var) Bool

func (v *Var) Bool() bool

Bool 将值转换为布尔型

func (*Var) Float64

func (v *Var) Float64() float64

Float64 将值转换为 float64

func (*Var) Int

func (v *Var) Int() int

Int 将值转换为 int

func (*Var) Int64

func (v *Var) Int64() int64

Int64 将值转换为 int64

func (*Var) Interface

func (v *Var) Interface() interface{}

Interface 是 Val 的别名

func (*Var) IsEmpty

func (v *Var) IsEmpty() bool

IsEmpty 检查值是否为空

func (*Var) IsFloat

func (v *Var) IsFloat() bool

IsFloat 检查值是否可以转换为浮点数

func (*Var) IsInt

func (v *Var) IsInt() bool

IsInt 检查值是否可以转换为整数

func (*Var) IsMap

func (v *Var) IsMap() bool

IsMap 检查值是否为映射类型

func (*Var) IsNil

func (v *Var) IsNil() bool

IsNil 检查值是否为 nil

func (*Var) IsSlice

func (v *Var) IsSlice() bool

IsSlice 检查值是否为切片类型

func (*Var) IsStruct

func (v *Var) IsStruct() bool

IsStruct 检查值是否为结构体

func (*Var) IsUint

func (v *Var) IsUint() bool

IsUint 检查值是否可以转换为无符号整数

func (*Var) Map

func (v *Var) Map() map[string]interface{}

Map 将值转换为 map[string]interface{}

func (*Var) MarshalJSON

func (v *Var) MarshalJSON() ([]byte, error)

MarshalJSON 实现 json.Marshaler 接口

func (*Var) String

func (v *Var) String() string

String 将值转换为字符串

func (*Var) Time

func (v *Var) Time(format ...string) time.Time

Time 将值转换为 time.Time format 参数用于指定时间字符串的格式

func (*Var) Uint64

func (v *Var) Uint64() uint64

Uint64 将值转换为 uint64

func (*Var) UnmarshalJSON

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

UnmarshalJSON 实现 json.Unmarshaler 接口

func (*Var) Val

func (v *Var) Val() interface{}

Val 返回原始值

Jump to

Keyboard shortcuts

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