Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyKind ¶
AnyKind returns true if v.Kind matchs k.
Example ¶
package main import ( "fmt" "reflect" "github.com/acaosx/gotils" ) func main() { v := reflect.ValueOf("gotils") fmt.Println(gotils.AnyKind(v, reflect.String)) fmt.Println(gotils.AnyKind(v, reflect.Uint)) }
Output: true false
func StringFromBytes ¶
StringFromBytes returns string from b without memory allocation.
Example ¶
package main import ( "fmt" "github.com/acaosx/gotils" ) func main() { fmt.Println(gotils.StringFromBytes([]byte{103, 111, 116, 105, 108, 115})) }
Output: gotils
func StringToBytes ¶
StringToBytes returns bytes from s without memory allocation.
Example ¶
package main import ( "fmt" "github.com/acaosx/gotils" ) func main() { fmt.Println(gotils.StringToBytes("gotils")) }
Output: [103 111 116 105 108 115]
Types ¶
type KindMap ¶
KindMap map of reflect.Kind.
Example ¶
package main import ( "fmt" "reflect" "github.com/acaosx/gotils" ) func main() { v := gotils.NewKindMap(reflect.String, reflect.Int) fmt.Println(v.Has(reflect.String)) fmt.Println(v.Has(reflect.Uint)) fmt.Println(v.Has(reflect.Int)) }
Output: true false true
func NewKindMap ¶
NewKindMap returns new KindMap of k.
Click to show internal directories.
Click to hide internal directories.