generic

package
v0.0.0-...-e4caca2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: 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 interface{}) 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 interface{}) *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 interface{}) bool

Is checks if input and given type are equal

@receiver t
@param input
@return bool

type Value

type Value struct {
	Input interface{}
}

Value wraps over interface

func Parse

func Parse(i interface{}) 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 interface{}) 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) 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) 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) 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) ParseJSON

func (v Value) ParseJSON(in interface{}) 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 interface{}) bool

func (*Value) Scan

func (v *Value) Scan(value interface{}) error

func (Value) SetProp

func (v Value) SetProp(property string, value interface{}) 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