Documentation ¶
Index ¶
- type KV
- func (kv *KV) BatchCreateOrUpdate(ctx context.Context, realm string, records []*Record) error
- func (kv *KV) Close() error
- func (kv *KV) CreateOrUpdate(ctx context.Context, realm string, record *Record) error
- func (kv *KV) Delete(ctx context.Context, realm string, record *Record) (bool, error)
- func (kv *KV) Get(ctx context.Context, realm string, record *Record) ([]*Record, error)
- func (kv *KV) Initialize(parentCtx context.Context) error
- func (kv *KV) Stmt(ctx context.Context, id stmtID) (*sql.Stmt, error)
- type Record
- type RecordJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KV ¶
KV implements a key value storage using a backend sql storage.
func New ¶
func New(dbDriverName string, dbDataSourceName string, dbMigrationsBasePath string, logger logrus.FieldLogger) (*KV, error)
New creates a new KV using the provided options.
func (*KV) BatchCreateOrUpdate ¶
BatchCreateOrUpdate implements batch mode data storage.
func (*KV) Close ¶
Close closes the accociated KV including everything in it.
func (*KV) CreateOrUpdate ¶
CreateOrUpdate implements data storage.
func (*KV) Delete ¶
Delete implements removal by key from data store.
func (*KV) Get ¶
Get Implements data retrieval from the accociated store.
func (*KV) Initialize ¶
Initialize connects to the associated KV store and runs migrations as required.
type Record ¶
type Record struct { Collection *string Key string Value []byte ContentType string OwnerID string ClientID string RequiredScopes string }
A Record holds the data stored in a KV.
func (*Record) EncodeToJSON ¶
func (r *Record) EncodeToJSON() (json.RawMessage, error)
EncodeToJSON encodes the accociated Record to JSON.
type RecordJSON ¶
type RecordJSON struct { Key *string `json:"key"` Value json.RawMessage `json:"value"` ContentType string `json:"content_type,omitempty"` }
A RecordJSON is the public JSON representation fo a Record.
Click to show internal directories.
Click to hide internal directories.