COPY | SugarDB (original) (raw)
The API provides a struct called COPYOptions that wraps these options in a convenient object.
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
db.Set("hello", "world")
key = db.Copy("hello", "bye")
Copy the value stored at key 'hello' in database 0 and replace the value at key 'bye' in database 1
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
err := db.SelectDB(1)
ok, err := db.Set("bye", "goodbye")
err := db.SelectDB(0)
ok, err := db.Set("hello", "world")
ret, err = db.Copy("hello", "bye", db.COPYOptions{Database: "1", Replace: true})