Documentation ¶
Overview ¶
Package storage provides a store wrapper over go-micro's store.Store and several implementations.
The store package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration.
Package storage provides a store wrapper over go-micro's store.Store and several implementations.
The store package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration.
Package storage provides a store wrapper over go-micro's store.Store and several implementations.
The store package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration.
Package storage provides a store wrapper over go-micro's store.Store and several implementations.
The store package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration.
Package storage provides a store wrapper over go-micro's store.Store and several implementations.
The store package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration. TODO: Refactor the interface
Index ¶
- type DeleteOption
- type DeleteOptions
- type ReadOption
- func ReadFrom(database, table string) ReadOption
- func ReadKey(val string) ReadOption
- func ReadLimit(val uint) ReadOption
- func ReadOffset(val uint) ReadOption
- func ReadPrefix(val string) ReadOption
- func ReadResult(val any) ReadOption
- func ReadSuffix(val string) ReadOption
- func ReadValue(val string) ReadOption
- type ReadOptions
- type RefinedStore
- type WriteOption
- type WriteOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteOption ¶
type DeleteOption func(d *DeleteOptions)
DeleteOption sets values in DeleteOptions.
func DeleteFrom ¶
func DeleteFrom(database, table string) DeleteOption
Sets database and database table.
type DeleteOptions ¶
DeleteOptions configures an individual Delete operation.
type ReadOption ¶
type ReadOption func(l *ReadOptions)
func ReadFrom ¶
func ReadFrom(database, table string) ReadOption
Sets database and database table read options.
func ReadResult ¶
func ReadResult(val any) ReadOption
Sets a pointer to populate it with the result.
type ReadOptions ¶
type ReadOptions struct {
// List from the following.
Database, Table string
// Key to read.
Key string
// Value to read (optional).
Value string
// Prefix returns all keys that are prefixed with key.
Prefix string
// Suffix returns all keys that end with key.
Suffix string
// Limit limits the number of returned keys.
Limit uint
// Offset when combined with Limit supports pagination.
Offset uint
// Result from the executed query.
Result any
}
type RefinedStore ¶
type RefinedStore interface { Init(opts ...store.Option) error List(ctx context.Context, opts ...ReadOption) error Read(ctx context.Context, opts ...ReadOption) error Write(ctx context.Context, payload any, opts ...WriteOption) error Update(ctx context.Context, payload any, opts ...WriteOption) error Delete(ctx context.Context, opts ...DeleteOption) error Options() store.Options String() string }
RefinedStore is a go-micro store.Store wrapper to allow SQL and No-SQL database operations.
func NewEmptyStore ¶
func NewEmptyStore() RefinedStore
A RefinedStore mongo constructor. Called automatically by fx and bootstrapper.
func NewMemoryStore ¶
func NewMemoryStore() RefinedStore
A RefinedStore go-micro in-memory constructor. Called automatically by fx and bootstrapper.
func NewMongoStore ¶
func NewMongoStore() RefinedStore
A RefinedStore mongo constructor. Called automatically by fx and bootstrapper.
func NewStorage ¶
func NewStorage(config *config.StorageConfig) RefinedStore
A RefinedStore constructor. Called automatically by fx and bootstrapper.
Returns a RefinedStore compliant implementation based on persistence configuration.
By default - empty adapter
type WriteOption ¶
type WriteOption func(w *WriteOptions)
type WriteOptions ¶
type WriteOptions struct {
Database, Table string
// Key is the key name to find and update the record (optional).
Key string
// Value is the key value to finad and update the record (optional).
Value string
// Expiry is the time the record expires.
Expiry time.Time
// TTL is the time until the record expires.
TTL time.Duration
}
WriteOptions configures an individual Write operation If Expiry and TTL are set TTL takes precedence.