The most suitable operation package for the job
最符合工作需要的操作包
本项目采用了Golang 来制作 Python 中比较流行的组件,作为迅捷开发的工具,减少重复造轮子的时间
项目基于 https://github.com/spf13/cast 大佬所创建的类型转置模块,后期将会用泛型重构
cast: safe and easy casting from one type to another in Go ;在 Go 中安全且轻松地从一种类型转换为另一种类型
将 python list 通过 go 实现,
- In(fat, sub interface{}) bool
- Index(fat, idx interface{}) int 不存在则为 -1
- Extend(fat, sub interface{}) interface{}
- Pop(fat interface{}, idx int) interface{}
- Remove(fat interface{}, value interface{}) interface{}
- Append(fat interface{}, value interface{}) interface{}
- Insert(fat interface{}, idx int, value interface{}) interface{}
- Count(fat interface{}, value interface{}) (count int)
- Equal(fat, sub interface{}) bool
将 python set 通过 go 实现,
- Set(fat interface{}) (sub interface{})
- Add(fat interface{}, value interface{}) (sub interface{})
- Union(fat interface{}, set ...interface{}) (sub interface{})
- Update(fat interface{}, set interface{}) (sub interface{})
package main
func main() {
//list := []int{
// 1, 2, 3,
//}
// param Slice sub
// return bool if exist true
// exist := oper.In(list, 1)
// exist true list is []int{ 1, 2, 3, } has 1
// fmt.Println(exist)
}
本项目使用Go Mod管理依赖。
go mod tidy // 自动管理
go run main.go