The awesome tool kit for Golang.
Waiting for generic type of golang.
-
ID generator
-
snowflake
-
serial no
-
-
Container tools
-
Slice
-
type
[]int
method:Distinct
,Merge
,Sort
,Filter
-
type
interface
-
-
Map tools
-
JSON Object
-
-
Bean
- Copy
go get -u github.com/CyrivlClth/go-tools
If you just want one of them, you can do like this:
go get -u github.com/CyrivlClth/go-tools/jsonobj
ID generator contains:
-
snowflake
-
simple serial no
...
func main() {
generator, _ := snowflake.New(0, 0)
id, _ := generator.NextID()
fmt.Println(id)
}
...
more detail for package github.com/CyrivlClth/go-tools/idgen/snowflake/cmd
serialnum.New(9).GetID()
package main
import (
"github.com/CyrivlClth/go-tools/container/set"
"github.com/CyrivlClth/go-tools/container/slice"
)
func main(){
slice.Integer([]int{3, 2, 5, 2}).Distinct()
// [3,2,5]
slice.Integer([]int{3, 2, 5, 2}).Contains(2)
// true
slice.Integer([]int{3, 2, 5, 2}).Sort()
// [2,2,3,5]
slice.Integer([]int{3, 2, 5, 2}).Filter(func(x int) bool {return x%2==0})
// [2,2]
int1 := slice.Integer([]int{3, 2, 5, 2})
int2 := slice.Integer([]int{4, 2, 5, 2})
set.NewIntegerSet(int1).Merge(int2)
// [3,2,5,4]
}
You can just create a new issues and commit your code
©CyrivlClth, 2019-time.Now()
Released under the MIT License