sutil

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ErrorType = 1
)

Variables

This section is empty.

Functions

func Copy

func Copy(src, dst interface{})

func FieldNames

func FieldNames(t reflect.Type) []string

func Get

func Get(v interface{}, field string) interface{}

func IndexByField

func IndexByField(structList interface{}, field string, value interface{}) int

func Kv2Map

func Kv2Map(s ...interface{}) map[string]interface{}

func MapGet

func MapGet(m interface{}, key interface{}) interface{}

func New

func New(s interface{}) *structs.Struct

New struct

func NewMap

func NewMap(m interface{}) map[interface{}]*structs.Struct

NewMap m : map[?]struct

func NewSlice

func NewSlice(structList interface{}) []*structs.Struct

NewSlice structList : []struct

func Pick

func Pick(s interface{}, keys ...string) map[string]interface{}

func Ptr

func Ptr(a interface{}) interface{}

func PtrType

func PtrType(t reflect.Type) reflect.Type

func PtrValue

func PtrValue(v reflect.Value) reflect.Value

func Struct2Map

func Struct2Map(s interface{}) map[string]interface{}

func Unpick

func Unpick(s interface{}, keys ...string) map[string]interface{}

Types

type A

type A []interface{}

type M

type M map[string]interface{}

type MS

type MS []M

type Map

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

Map like map[string]User

func FromMap

func FromMap(emptyMapAddr interface{}) *Map

NewMap useage : var m map[string]User NewMap(&m)

func (*Map) Each

func (m *Map) Each(fn func(k, v interface{}))

func (*Map) EmptyValue

func (m *Map) EmptyValue() interface{}

func (*Map) Get

func (m *Map) Get(key interface{}) interface{}

func (*Map) Make

func (m *Map) Make() *Map

func (*Map) MakeWithSize

func (m *Map) MakeWithSize(size int) *Map

func (*Map) NewValue

func (m *Map) NewValue() interface{}

func (*Map) Put

func (m *Map) Put(key, value interface{})

func (*Map) PutJson

func (m *Map) PutJson(key interface{}, jsonBs []byte) error

type Slice

type Slice struct {
	Len int
	Cap int
	// contains filtered or unexported fields
}

func FromSlice

func FromSlice(arr interface{}) *Slice

FromSlice to fill slice. var a []int; FromSlice(*a).Make()

func (*Slice) Each

func (s *Slice) Each(fn func(i int, v interface{}))

func (*Slice) Get

func (s *Slice) Get(i int) interface{}

func (*Slice) GetRef

func (s *Slice) GetRef(i int) interface{}

func (*Slice) Make

func (s *Slice) Make(length int) *Slice

func (*Slice) Put

func (s *Slice) Put(i int, value interface{})

type Structs

type Structs []interface{}

func Col

func Col(structList interface{}, field string) Structs

Col structList []struct

func (Structs) Floats

func (s Structs) Floats() []float64

func (Structs) Int64s

func (s Structs) Int64s() []int64

func (Structs) Ints

func (s Structs) Ints() []int

func (Structs) Strings

func (s Structs) Strings() []string

Jump to

Keyboard shortcuts

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