Skip to content

Commit 39433a9

Browse files
author
zhengkeyan
committed
加个自定义类型的内存数据库
1 parent f5829d8 commit 39433a9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

memdb/db.go

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ func New() *DB {
1616
return &DB{Data: make(map[string]interface{})}
1717
}
1818

19+
func (db *DB) Append(value interface{}, key ...string) error {
20+
k := strings.Join(key, ".")
21+
return db.Insert(k, value)
22+
}
23+
1924
func (db *DB) Insert(key string, value interface{}) error {
2025
keys := strings.Split(key, ".")
2126
current := db.Data

0 commit comments

Comments
 (0)