llgo:rust:sled:a working demo

This commit is contained in:
luoliwoshang
2024-07-05 17:43:33 +08:00
parent a36d5b6302
commit a2fd010521
2 changed files with 54 additions and 18 deletions

View File

@@ -6,11 +6,12 @@ import (
)
func main() {
//c.Printf(c.Str("helloworld\n"))
var valueLen c.Ulong
conf := &sled.SledConfig{}
conf.SetPath(c.Str("./db.sled"))
db := conf.OpenDB()
conf := sled.CreateConfig()
path := c.Str("./db")
copyPath := c.Strdup(path)
pathConfig := conf.SetPath(copyPath)
db := pathConfig.OpenDb()
db.Set(c.Str("key"), 3, c.Str("value"), 5)
value := db.Get(c.Str("key"), 3, &valueLen)
c.Printf(c.Str("value: %s\n"), value)