This commit is contained in:
cdle
2021-10-09 18:26:10 +08:00
parent 095162d90c
commit c701f1ddd4
4 changed files with 17 additions and 12 deletions
+7 -2
View File
@@ -116,11 +116,16 @@ func (bucket Bucket) Foreach(f func(k, v []byte) error) {
})
}
var Int = func(s string) int {
i, _ := strconv.Atoi(s)
var Int = func(s interface{}) int {
i, _ := strconv.Atoi(fmt.Sprint(s))
return i
}
var Int64 = func(s interface{}) int64 {
i, _ := strconv.Atoi(fmt.Sprint(s))
return int64(i)
}
func (bucket Bucket) Create(i interface{}) error {
s := reflect.ValueOf(i).Elem()
id := s.FieldByName("ID")