The Go SDK is currently in experimental status. If you would like to provide feedback, please reach out to us with your suggestions and comments on our Discord.
Go - Kv.Delete()
Delete key from a key value store.
import (
	"context"
	"fmt"
	"github.com/nitrictech/go-sdk/nitric"
)
func main() {
	// Initialize the KV service
	profiles, err := nitric.NewKv("profiles").Allow(nitric.KvStoreDelete)
	if err != nil {
		return
	}
	err = profiles.Delete(context.Background(), "profile-1a2b3c")
	if err != nil {
		fmt.Println(err)
	}
	if err := nitric.Run(); err != nil {
		fmt.Println(err)
	}
}
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"
)
func main() {
	// Initialize the KV service
	profiles, err := nitric.NewKv("profiles").Allow(nitric.KvStoreDelete)
	if err != nil {
		return
	}
	err = profiles.Delete(context.Background(), "profile-1a2b3c")
	if err != nil {
		fmt.Println(err)
	}
	if err := nitric.Run(); err != nil {
		fmt.Println(err)
	}
}