Documentation ¶
Index ¶
- func ByteToObj(buf []byte, out interface{}) (err error)
- func CopySlice[In any, Out any](in []In) []Out
- func DeepCopySlice[In any](in []In) []In
- func MapToObj(maps map[string]interface{}, out interface{}) error
- func Marshal(in interface{}) (str string, err error)
- func Max[T any](o1, o2 T) T
- func Min[T any](o1, o2 T) T
- func ObjToByte(in interface{}) (buf []byte, err error)
- func ObjToJsonStr(obj interface{}) (str string)
- func ObjToMap(in interface{}) map[string]interface{}
- func SliceMap[In any, Out any](slice []In, f func(in In) Out) []Out
- func SliceToMap[A any, ID comparable](slice []A, f func(element A) ID) maps.IMap[ID, A]
- func Unmarshal(in string, out interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ObjToJsonStr ¶
func ObjToJsonStr(obj interface{}) (str string)
func SliceToMap ¶
func SliceToMap[A any, ID comparable](slice []A, f func(element A) ID) maps.IMap[ID, A]
SliceToMap Slice to Map
example:
type Person struct { ID int } p1 := &Person{ID: 1} p2 := &Person{ID: 2} p3 := &Person{ID: 3} people := make([]*Person, 0) people = append(people, p1, p2, p3) m := SliceToMap(people, func(element *Person) int { return element.ID }) v, _ := m.Get(1)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.