Go - Kv.Delete()
Delete key from a key value store.
import ("context""fmt""github.com/nitrictech/go-sdk/nitric""github.com/nitrictech/go-sdk/nitric/keyvalue")func main() {// Initialize the KV serviceprofiles := nitric.NewKv("profiles").Allow(keyvalue.KvStoreDelete)err := profiles.Delete(context.Background(), "profile-1a2b3c")if err != nil {fmt.Println(err)}nitric.Run()}
Parameters
- Name
ctx
- Required
- Required
- Type
- context
- Description
The context of the call, used for tracing.
- Name
key
- Required
- Required
- Type
- string
- Description
The key that references the key value pair that should be deleted.
Examples
Delete a key
import ("context""fmt""github.com/nitrictech/go-sdk/nitric""github.com/nitrictech/go-sdk/nitric/keyvalue")func main() {// Initialize the KV serviceprofiles := nitric.NewKv("profiles").Allow(keyvalue.KvStoreDelete)err := profiles.Delete(context.Background(), "profile-1a2b3c")if err != nil {fmt.Println(err)}nitric.Run()}
Last updated on Dec 19, 2024