MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / getSet

Function getSet

examples/basic/main.go:180–196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178}
179
180func getSet() {
181 if err := db.Update(
182 func(tx *nutsdb.Tx) error {
183 key := []byte("name1")
184 val := []byte("val3")
185 oldValue, err := tx.GetSet(bucket, key, val)
186 if err != nil {
187 return err
188 }
189
190 fmt.Println("old value :", string(oldValue))
191
192 return nil
193 }); err != nil {
194 log.Println(err)
195 }
196}
197
198func getTTL() {
199 if err := db.View(func(tx *nutsdb.Tx) error {

Callers 1

mainFunction · 0.85

Calls 2

UpdateMethod · 0.80
GetSetMethod · 0.80

Tested by

no test coverage detected