generic

package
v2.0.0-...-10e4721 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Invalid reflect.Kind = iota
	Bool
	Int
	Int8
	Int16
	Int32
	Int64
	Uint
	Uint8
	Uint16
	Uint32
	Uint64
	Uintptr
	Float32
	Float64
	Complex64
	Complex128
	Array
	Chan
	Func
	Interface
	Map
	Ptr
	Slice
	String
	Struct
	UnsafePointer
)

Variables

This section is empty.

Functions

func ToString

func ToString(v any) string

ToString cast anything to string

@param v
@return string

Types

type Type

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

Type lib structure to keep input and its type

func TypeOf

func TypeOf(input any) *Type

TypeOf return type of input

@param input
@return *Type

func (*Type) Indirect

func (t *Type) Indirect() *Type

Indirect get type of object considering if it is pointer

@receiver t
@return *Type

func (*Type) Is

func (t *Type) Is(input any) bool

Is checks if input and given type are equal

@receiver t
@param input
@return bool

type Value

type Value struct {
	Input any
}

Value wraps over interface

func Parse

func Parse(i any) Value

Parse parse input

@param i
@return Value

func (Value) Bool

func (v Value) Bool() bool

Bool return value as bool

@receiver v
@return bool

func (Value) ByteCount

func (v Value) ByteCount() string

func (Value) Cast

func (v Value) Cast(dst any) error

func (Value) Duration

func (v Value) Duration() (time.Duration, error)

Duration return value as time.Duration

@receiver v
@return time.Duration
@return error

func (Value) FieldNames

func (v Value) FieldNames() []string

func (Value) Float

func (v Value) Float() float64

Float return value as float64

@receiver v
@return float64

func (Value) Float32

func (v Value) Float32() float32

func (Value) Float64

func (v Value) Float64() float64

func (Value) GetName

func (v Value) GetName(name string) string

func (Value) HasProp

func (v Value) HasProp(name string) bool

func (Value) Indirect

func (v Value) Indirect() reflect.Value

func (Value) IndirectType

func (v Value) IndirectType() reflect.Type

func (Value) Int

func (v Value) Int() int

Int return value as integer

@receiver v
@return int

func (Value) Int16

func (v Value) Int16() int16

func (Value) Int32

func (v Value) Int32() int32

func (Value) Int64

func (v Value) Int64() int64

Int64 return value as int64

@receiver v
@return int64

func (Value) Int8

func (v Value) Int8() int8

func (Value) Is

func (v Value) Is(s string) bool

func (Value) IsAny

func (v Value) IsAny(s ...any) bool

func (Value) IsEmpty

func (v Value) IsEmpty() bool

func (Value) IsNil

func (v Value) IsNil() bool

IsNil returns if the value is nil

@receiver v
@return bool

func (*Value) MarshalJSON

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

func (*Value) MarshalYAML

func (v *Value) MarshalYAML() ([]byte, error)

func (Value) New

func (v Value) New() Value

func (Value) ParseJSON

func (v Value) ParseJSON(in any) error

ParseJSON parse json value into struct

@receiver v
@param in
@return error

func (Value) Prop

func (v Value) Prop(property string) Value

func (Value) PropByTag

func (v Value) PropByTag(tag string) Value

func (Value) Props

func (v Value) Props() []reflect.StructField

func (Value) SameAs

func (v Value) SameAs(s any) bool

func (*Value) Scan

func (v *Value) Scan(value any) error

func (Value) SetProp

func (v Value) SetProp(property string, value any) error

func (Value) SizeInBytes

func (v Value) SizeInBytes() uint64

func (Value) String

func (v Value) String() string

String return value as string

@receiver v
@return string

func (Value) Time

func (v Value) Time() (time.Time, error)

Time return value as time.Time

@receiver v
@return time.Time
@return error

func (Value) Uint

func (v Value) Uint() uint

func (Value) Uint16

func (v Value) Uint16() uint16

func (Value) Uint32

func (v Value) Uint32() uint32

func (Value) Uint64

func (v Value) Uint64() uint64

Uint64 return value as uint64

@receiver v
@return uint64

func (Value) Uint8

func (v Value) Uint8() uint8

func (*Value) UnmarshalJSON

func (v *Value) UnmarshalJSON(data []byte) error

func (*Value) UnmarshalYAML

func (v *Value) UnmarshalYAML(data []byte) error

func (Value) Value

func (v Value) Value() (driver.Value, error)

Value return drive.Value value, implement driver.Valuer interface of gorm

Jump to

Keyboard shortcuts

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