1
0
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:
asim 2025-05-04 20:00:44 +01:00
parent c51095a074
commit 484eb3d15e

View File

@ -59,3 +59,24 @@ func NewRecord(key string, val interface{}) *Record {
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...)
}