mirror of
https://github.com/go-micro/go-micro.git
synced 2025-06-18 22:17:44 +02:00
store.NewRecord
This commit is contained in:
@ -5,6 +5,8 @@ package store
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -49,3 +51,11 @@ type Record struct {
|
||||
func NewStore(opts ...Option) Store {
|
||||
return NewMemoryStore(opts...)
|
||||
}
|
||||
|
||||
func NewRecord(key string, val interface{}) *Record {
|
||||
b, _ := json.Marshal(val)
|
||||
return &Record{
|
||||
Key: key,
|
||||
Value: b,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user