Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KV stores value as a json #3911

Open
2 tasks done
aliforever opened this issue Feb 10, 2025 · 0 comments
Open
2 tasks done

KV stores value as a json #3911

aliforever opened this issue Feb 10, 2025 · 0 comments

Comments

@aliforever
Copy link

Confirm this is not a feature request

  • This is a bug

Confirm this is a Go library issue and not an underlying Cloudflare API issue

  • This is an issue with the Go library

Describe the bug

Using client.KV.Namespaces.Values.Update stores KV value as {"value": "...."}.

Image

type NamespaceValueUpdateParams struct {
	// Identifier
	AccountID param.Field[string] `path:"account_id,required"`
	// Arbitrary JSON to be associated with a key/value pair.
	Metadata param.Field[string] `json:"metadata,required"`
	// A byte sequence to be stored, up to 25 MiB in length.
	Value param.Field[string] `json:"value,required"`
	// The time, measured in number of seconds since the UNIX epoch, at which the key
	// should expire.
	Expiration param.Field[float64] `query:"expiration"`
	// The number of seconds for which the key should be visible before it expires. At
	// least 60.
	ExpirationTTL param.Field[float64] `query:"expiration_ttl"`
}

To Reproduce

_, err = client.KV.Namespaces.Values.Update(
			context.Background(),
			{namespaceid},
			{keyid},
			kv.NamespaceValueUpdateParams{
				AccountID:  cloudflare.F({account_id}),
				Value:      cloudflare.F({value}),
				Expiration: cloudflare.F(float64({expiry})),
			},
		)

Code snippets

OS

Windows

Go version

Go 1.23

Library version

github.com/cloudflare/cloudflare-go/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant