Documentation
¶
Overview ¶
Code generated by ogen, DO NOT EDIT.
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Batch
- func (s *Batch) Decode(d *jx.Decoder) error
- func (s *Batch) Encode(e *jx.Encoder)
- func (s *Batch) GetCursor() int64
- func (s *Batch) GetKeys() []string
- func (s *Batch) MarshalJSON() ([]byte, error)
- func (s *Batch) SetCursor(val int64)
- func (s *Batch) SetKeys(val []string)
- func (s *Batch) UnmarshalJSON(data []byte) error
- func (s *Batch) Validate() error
- type Client
- func (c *Client) Delete(ctx context.Context, params DeleteParams) error
- func (c *Client) DeleteNamespace(ctx context.Context, params DeleteNamespaceParams) error
- func (c *Client) Get(ctx context.Context, params GetParams) (GetRes, error)
- func (c *Client) Keys(ctx context.Context, params KeysParams) (*Batch, error)
- func (c *Client) Set(ctx context.Context, request *SetReqWithContentType, params SetParams) error
- type ClientOption
- type DeleteNamespaceNoContent
- type DeleteNamespaceParams
- type DeleteNoContent
- type DeleteParams
- type GetNotFound
- type GetOK
- type GetOKHeaders
- func (s *GetOKHeaders) GetResponse() GetOK
- func (s *GetOKHeaders) GetXContentType() string
- func (s *GetOKHeaders) GetXTTL() OptFloat64
- func (s *GetOKHeaders) SetResponse(val GetOK)
- func (s *GetOKHeaders) SetXContentType(val string)
- func (s *GetOKHeaders) SetXTTL(val OptFloat64)
- func (s *GetOKHeaders) Validate() error
- type GetParams
- type GetRes
- type HeaderAuth
- type HeaderToken
- type Iterator
- type KV
- func (app *KV) Delete(ctx context.Context, key string) error
- func (app *KV) Destroy(ctx context.Context) error
- func (app *KV) Get(ctx context.Context, key string) ([]byte, error)
- func (app *KV) Keys() *Iterator
- func (app *KV) Set(ctx context.Context, key string, data []byte) error
- func (app *KV) SetExpire(ctx context.Context, key string, data []byte, ttl time.Duration) error
- type KeysParams
- type OptFloat64
- type OptInt64
- type Option
- type SecuritySource
- type SetNoContent
- type SetParams
- type SetReq
- type SetReqWithContentType
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Batch ¶
type Batch struct { // Keys list. Keys []string `json:"keys"` // Cursor used for pagination. Cursor int64 `json:"cursor"` }
Ref: #/components/schemas/batch
func (*Batch) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Batch) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements OAS client.
func NewClient ¶
func NewClient(serverURL string, sec SecuritySource, opts ...ClientOption) (*Client, error)
NewClient initializes new Client defined by OAS.
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, params DeleteParams) error
Delete invokes delete operation.
Delete key. Does nothing if key not exists.
DELETE /{namespace}/{key}
func (*Client) DeleteNamespace ¶
func (c *Client) DeleteNamespace(ctx context.Context, params DeleteNamespaceParams) error
DeleteNamespace invokes deleteNamespace operation.
Delete namespace and all keys.
DELETE /{namespace}
func (*Client) Keys ¶
Keys invokes keys operation.
List keys in namespace page by page. Iteration may not be consistent if there are updates between pages. At the end of page, operation will return empty list. Iteration order is non-deterministic, but generally tends to be from oldest key to newest key.
GET /{namespace}
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
ClientOption is client config option.
func WithClient ¶
func WithClient(client ht.Client) ClientOption
WithClient specifies http client to use.
type DeleteNamespaceNoContent ¶
type DeleteNamespaceNoContent struct{}
DeleteNamespaceNoContent is response for DeleteNamespace operation.
type DeleteNamespaceParams ¶
type DeleteNamespaceParams struct { // Key-Value namespace. Namespace string }
DeleteNamespaceParams is parameters of deleteNamespace operation.
type DeleteNoContent ¶
type DeleteNoContent struct{}
DeleteNoContent is response for Delete operation.
type DeleteParams ¶
DeleteParams is parameters of delete operation.
type GetOKHeaders ¶
type GetOKHeaders struct { XContentType string XTTL OptFloat64 Response GetOK }
GetOKHeaders wraps GetOK with response headers.
func (*GetOKHeaders) GetResponse ¶
func (s *GetOKHeaders) GetResponse() GetOK
GetResponse returns the value of Response.
func (*GetOKHeaders) GetXContentType ¶
func (s *GetOKHeaders) GetXContentType() string
GetXContentType returns the value of XContentType.
func (*GetOKHeaders) GetXTTL ¶
func (s *GetOKHeaders) GetXTTL() OptFloat64
GetXTTL returns the value of XTTL.
func (*GetOKHeaders) SetResponse ¶
func (s *GetOKHeaders) SetResponse(val GetOK)
SetResponse sets the value of Response.
func (*GetOKHeaders) SetXContentType ¶
func (s *GetOKHeaders) SetXContentType(val string)
SetXContentType sets the value of XContentType.
func (*GetOKHeaders) SetXTTL ¶
func (s *GetOKHeaders) SetXTTL(val OptFloat64)
SetXTTL sets the value of XTTL.
func (*GetOKHeaders) Validate ¶
func (s *GetOKHeaders) Validate() error
type HeaderAuth ¶
type HeaderAuth struct {
APIKey string
}
func (*HeaderAuth) GetAPIKey ¶
func (s *HeaderAuth) GetAPIKey() string
GetAPIKey returns the value of APIKey.
func (*HeaderAuth) SetAPIKey ¶
func (s *HeaderAuth) SetAPIKey(val string)
SetAPIKey sets the value of APIKey.
type HeaderToken ¶
type HeaderToken string
HeaderToken is header base authorization with pre-shared token.
func (HeaderToken) HeaderAuth ¶
func (ta HeaderToken) HeaderAuth(_ context.Context, _ string) (HeaderAuth, error)
type KV ¶ added in v0.1.3
type KV struct {
// contains filtered or unexported fields
}
KV is simplified wrapper around client.
func Dial ¶ added in v0.1.3
Example ¶
ctx := context.Background() // errors omitted for demonstration purpose kv, _ := Dial("https://example.com", "my-app", "deadbeaf") // set item _ = kv.Set(ctx, "foo", []byte("bar")) // get item value, _ := kv.Get(ctx, "foo") fmt.Println("Got", string(value)) // delete item _ = kv.Delete(ctx, "foo")
Output:
func (*KV) Keys ¶ added in v0.1.3
Keys in namespace.
Example ¶
ctx := context.Background() // errors omitted for demonstration purpose kv, _ := Dial("https://example.com", "my-app", "deadbeaf") // set item _ = kv.Set(ctx, "foo", []byte("bar")) _ = kv.Set(ctx, "bar", []byte("baz")) // iterate it := kv.Keys() for it.Next(ctx) { for _, key := range it.Keys() { fmt.Println(key) } } // check errors if it.Error() != nil { panic(it.Error()) }
Output:
type KeysParams ¶
type KeysParams struct { // Key-Value namespace. Namespace string // Cursor of the previous page, should be passed in from the previous request or absent for new // request. Cursor OptInt64 }
KeysParams is parameters of keys operation.
type OptFloat64 ¶
OptFloat64 is optional float64.
func NewOptFloat64 ¶
func NewOptFloat64(v float64) OptFloat64
NewOptFloat64 returns new OptFloat64 with value set to v.
func (OptFloat64) Get ¶
func (o OptFloat64) Get() (v float64, ok bool)
Get returns value and boolean that denotes whether value was set.
func (OptFloat64) IsSet ¶
func (o OptFloat64) IsSet() bool
IsSet returns true if OptFloat64 was set.
func (OptFloat64) Or ¶
func (o OptFloat64) Or(d float64) float64
Or returns value if set, or given parameter if does not.
type OptInt64 ¶
OptInt64 is optional int64.
func NewOptInt64 ¶
NewOptInt64 returns new OptInt64 with value set to v.
type Option ¶
type Option interface { ClientOption }
Option is config option.
func WithMeterProvider ¶
func WithMeterProvider(provider metric.MeterProvider) Option
WithMeterProvider specifies a meter provider to use for creating a meter.
If none is specified, the otel.GetMeterProvider() is used.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) Option
WithTracerProvider specifies a tracer provider to use for creating a tracer.
If none is specified, the global provider is used.
type SecuritySource ¶
type SecuritySource interface { // HeaderAuth provides HeaderAuth security value. HeaderAuth(ctx context.Context, operationName string) (HeaderAuth, error) }
SecuritySource is provider of security values (tokens, passwords, etc.).
type SetParams ¶
type SetParams struct { // Key-Value namespace. Namespace string // Key name. Key string // Time-to-live for the key in seconds (floating). TTL OptFloat64 }
SetParams is parameters of set operation.
type SetReqWithContentType ¶
SetReqWithContentType wraps SetReq with Content-Type.
func (*SetReqWithContentType) GetContent ¶
func (s *SetReqWithContentType) GetContent() SetReq
GetContent returns the value of Content.
func (*SetReqWithContentType) GetContentType ¶
func (s *SetReqWithContentType) GetContentType() string
GetContentType returns the value of ContentType.
func (*SetReqWithContentType) SetContent ¶
func (s *SetReqWithContentType) SetContent(val SetReq)
SetContent sets the value of Content.
func (*SetReqWithContentType) SetContentType ¶
func (s *SetReqWithContentType) SetContentType(val string)
SetContentType sets the value of ContentType.