mvar

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String(value any) string

String will convert any type to a string.

Types

type Var

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

Var is a universal variable type implementation.

func New

func New(value any, safe ...bool) *Var

New creates and returns a new Var. The safe parameter is used to specify whether to enable thread safety, the default is false.

func (*Var) Bool

func (v *Var) Bool() bool

Bool converts the value to a boolean.

func (*Var) Float64

func (v *Var) Float64() float64

Float64 converts the value to a float64.

func (*Var) Int

func (v *Var) Int() int

Int converts the value to an int.

func (*Var) Int64

func (v *Var) Int64() int64

Int64 converts the value to an int64.

func (*Var) Interface

func (v *Var) Interface() any

Interface is an alias for Val.

func (*Var) IsEmpty

func (v *Var) IsEmpty() bool

IsEmpty checks if the value is empty.

func (*Var) IsFloat

func (v *Var) IsFloat() bool

IsFloat checks if the value can be converted to a float.

func (*Var) IsInt

func (v *Var) IsInt() bool

IsInt checks if the value can be converted to an integer.

func (*Var) IsMap

func (v *Var) IsMap() bool

IsMap checks if the value is a map type.

func (*Var) IsNil

func (v *Var) IsNil() bool

IsNil checks if the value is nil.

func (*Var) IsSlice

func (v *Var) IsSlice() bool

IsSlice checks if the value is a slice type.

func (*Var) IsStruct

func (v *Var) IsStruct() bool

IsStruct checks if the value is a struct type.

func (*Var) IsUint

func (v *Var) IsUint() bool

IsUint checks if the value can be converted to an unsigned integer.

func (*Var) Map

func (v *Var) Map() map[string]any

Map will convert the value to a map[string]any.

func (*Var) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

func (*Var) Set

func (v *Var) Set(value any) (old any)

func (*Var) String

func (v *Var) String() string

String converts the value to a string.

func (*Var) Struct added in v0.1.4

func (v *Var) Struct(pointer any, hooks ...mconv.HookFunc) error

Struct maps the value to a struct. The `pointer` parameter should be a pointer to a struct. The `hooks` parameter is used to specify the hooks for the conversion.

func (*Var) Time

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

Time converts the value to a time.Time. The format parameter is used to specify the format of the time string.

func (*Var) Uint64

func (v *Var) Uint64() uint64

Uint64 converts the value to an uint64.

func (*Var) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Var) Val

func (v *Var) Val() any

Val returns the original value.

Jump to

Keyboard shortcuts

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