Documentation ¶
Overview ¶
Package store is an interface for distributed data storage. The design document is located at https://github.com/micro/development/blob/master/design/store.md
Index ¶
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
type DeleteOptions ¶
type DeleteOptions struct{}
DeleteOptions configures an individual Delete operation
type ListOption ¶
type ListOption func(l *ListOptions)
ListOption sets values in ListOptions
func ListLimit ¶
func ListLimit(l uint) ListOption
ListLimit limits the number of returned keys to l
func ListOffset ¶
func ListOffset(o uint) ListOption
ListOffset starts returning responses from o. Use in conjunction with Limit for pagination.
func ListPrefix ¶
func ListPrefix(p string) ListOption
ListPrefix returns all keys that are prefixed with key
func ListSuffix ¶
func ListSuffix(s string) ListOption
ListSuffix returns all keys that end with key
type ListOptions ¶
type ListOptions struct { // 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 }
ListOptions configures an individual List operation
type Option ¶
type Option func(o *Options)
Option sets values in Options
func Namespace ¶
Namespace allows multiple isolated stores to be kept in one backend, if supported. For example multiple tables in a SQL store.
func Nodes ¶
Nodes contains the addresses or other connection information of the backing storage. For example, an etcd implementation would contain the nodes of the cluster. A SQL implementation could contain one or more connection strings.
func WithContext ¶
WithContext sets the stores context, for any extra configuration
type Options ¶
type Options struct { // Nodes contains the addresses or other connection information of the backing storage. // For example, an etcd implementation would contain the nodes of the cluster. // A SQL implementation could contain one or more connection strings. Nodes []string // Namespace allows multiple isolated stores to be kept in one backend, if supported. // For example multiple tables in a SQL store. Namespace string // Prefix sets a global prefix on all keys Prefix string // Suffix sets a global suffix on all keys Suffix string // Context should contain all implementation specific options, using context.WithValue. Context context.Context }
Options contains configuration for the Store
type ReadOption ¶
type ReadOption func(r *ReadOptions)
ReadOption sets values in ReadOptions
func ReadOffset ¶
func ReadOffset(o uint) ReadOption
ReadOffset starts returning responses from o. Use in conjunction with Limit for pagination
func ReadPrefix ¶
func ReadPrefix() ReadOption
ReadPrefix returns all records that are prefixed with key
func ReadSuffix ¶
func ReadSuffix() ReadOption
ReadSuffix returns all records that have the suffix key
type ReadOptions ¶
type ReadOptions struct { // Prefix returns all records that are prefixed with key Prefix bool // Suffix returns all records that have the suffix key Suffix bool // Limit limits the number of returned records Limit uint // Offset when combined with Limit supports pagination Offset uint }
ReadOptions configures an individual Read operation
type Store ¶
type Store interface { // Init initialises the store. It must perform any required setup on the backing storage implementation and check that it is ready for use, returning any errors. Init(...Option) error // Options allows you to view the current options. Options() Options // String returns the name of the implementation. String() string // Read takes a single key name and optional ReadOptions. It returns matching []*Record or an error. Read(key string, opts ...ReadOption) ([]*Record, error) // Write() writes a record to the store, and returns an error if the record was not written. Write(r *Record, opts ...WriteOption) error // Delete removes the record with the corresponding key from the store. Delete(key string, opts ...DeleteOption) error // List returns any keys that match, or an empty list with no error if none matched. List(opts ...ListOption) ([]string, error) }
Store is a data storage interface
type WriteOption ¶
type WriteOption func(w *WriteOptions)
WriteOption sets values in WriteOptions
func WriteExpiry ¶
func WriteExpiry(t time.Time) WriteOption
WriteExpiry is the time the record expires
Directories ¶
Path | Synopsis |
---|---|
Package cloudflare is a store implementation backed by cloudflare workers kv Note that the cloudflare workers KV API is eventually consistent.
|
Package cloudflare is a store implementation backed by cloudflare workers kv Note that the cloudflare workers KV API is eventually consistent. |
Package cockroach implements the cockroach store
|
Package cockroach implements the cockroach store |
Package etcd implements a go-micro/v2/store with etcd
|
Package etcd implements a go-micro/v2/store with etcd |
Package memory is a in-memory store store
|
Package memory is a in-memory store store |
Package service implements the store service interface
|
Package service implements the store service interface |