Documentation ¶
Overview ¶
Package kv provides a key-value store with optional authentication and HTTP server functionality.
Index ¶
- type Builder
- type KV
- func (k *KV) AuthMiddleware(_ *mux.Router) mux.MiddlewareFunc
- func (k *KV) Clear() error
- func (k *KV) Data() *hashmap.Map
- func (k *KV) Get(key string) (interface{}, error)
- func (k *KV) Has(key string) bool
- func (k *KV) Keys() []interface{}
- func (k *KV) Remove(key string) error
- func (k *KV) Serve(port int) error
- func (k *KV) Set(key string, value interface{}) error
- func (k *KV) Size() int
- func (k *KV) ToJSON() ([]byte, error)
- func (k *KV) Values() []interface{}
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a builder for KV.
func WithRandomBearerToken ¶
func WithRandomBearerToken() *Builder
WithRandomBearerToken sets a random bearer token for the KV.
func (*Builder) WithAddress ¶
WithAddress sets the address for the KV.
type KV ¶
type KV struct {
// contains filtered or unexported fields
}
KV represents a key-value store with optional authentication and network address configuration.
func (*KV) AuthMiddleware ¶
func (k *KV) AuthMiddleware(_ *mux.Router) mux.MiddlewareFunc
AuthMiddleware returns a middleware function that enforces authentication for HTTP requests.
func (*KV) Keys ¶
func (k *KV) Keys() []interface{}
Keys returns a slice of all keys currently stored in the KV store.
func (*KV) Serve ¶
Serve starts the HTTP server on the specified port with configured routes and middleware.
Click to show internal directories.
Click to hide internal directories.