mirror of
https://github.com/go-micro/go-micro.git
synced 2025-05-25 21:53:14 +02:00
public functions for store
This commit is contained in:
parent
c51095a074
commit
484eb3d15e
@ -59,3 +59,24 @@ func NewRecord(key string, val interface{}) *Record {
|
|||||||
Value: b,
|
Value: b,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read records
|
||||||
|
func Read(key string, opts ...ReadOption) ([]*Record, error) {
|
||||||
|
// execute the query
|
||||||
|
return DefaultStore.Read(key, opts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write a record to the store
|
||||||
|
func Write(r *Record) error {
|
||||||
|
return DefaultStore.Write(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete removes the record with the corresponding key from the store.
|
||||||
|
func Delete(key string) error {
|
||||||
|
return DefaultStore.Delete(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
// List returns any keys that match, or an empty list with no error if none matched.
|
||||||
|
func List(opts ...ListOption) ([]string, error) {
|
||||||
|
return DefaultStore.List(opts...)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user