Documentation
¶
Index ¶
- type GetOptions
- type ListKey
- type ListOptions
- type ListResult
- type Namespace
- func (ns *Namespace) Delete(key string) error
- func (ns *Namespace) GetReader(key string, opts *GetOptions) (io.Reader, error)
- func (ns *Namespace) GetString(key string, opts *GetOptions) (string, error)
- func (ns *Namespace) List(opts *ListOptions) (*ListResult, error)
- func (ns *Namespace) PutReader(key string, value io.Reader, opts *PutOptions) error
- func (ns *Namespace) PutString(key string, value string, opts *PutOptions) error
- type PutOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetOptions ¶
type GetOptions struct {
CacheTTL int
}
GetOptions represents Cloudflare KV namespace get options.
type ListKey ¶
type ListKey struct { Name string // Expiration is an expiration of KV value cache. The value `0` means no expiration. Expiration int }
ListKey represents Cloudflare KV namespace list key.
type ListOptions ¶
ListOptions represents Cloudflare KV namespace list options.
type ListResult ¶
ListResult represents Cloudflare KV namespace list result.
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace represents interface of Cloudflare Worker's KV namespace instance.
- https://developers.cloudflare.com/workers/runtime-apis/kv/
- https://github.com/cloudflare/workers-types/blob/3012f263fb1239825e5f0061b267c8650d01b717/index.d.ts#L850
func NewNamespace ¶
NewNamespace returns Namespace for given variable name.
- variable name must be defined in wrangler.toml as kv_namespace's binding.
- if the given variable name doesn't exist on runtime context, returns error.
- This function panics when a runtime context is not found.
func (*Namespace) Delete ¶
Delete deletes key-value pair specified by the key.
- if a network error happens, returns error.
func (*Namespace) GetReader ¶
GetReader gets stream value by the specified key.
- if a network error happens, returns error.
func (*Namespace) GetString ¶
func (ns *Namespace) GetString(key string, opts *GetOptions) (string, error)
GetString gets string value by the specified key.
- if a network error happens, returns error.
func (*Namespace) List ¶
func (ns *Namespace) List(opts *ListOptions) (*ListResult, error)
List lists keys stored into the KV namespace.
type PutOptions ¶
PutOptions represents Cloudflare KV namespace put options.
Click to show internal directories.
Click to hide internal directories.