1
0
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:
asim
2025-05-04 19:55:10 +01:00
parent 03782bc9b3
commit c51095a074

View File

@ -5,6 +5,8 @@ package store
import ( import (
"errors" "errors"
"time" "time"
"encoding/json"
) )
var ( var (
@ -49,3 +51,11 @@ type Record struct {
func NewStore(opts ...Option) Store { func NewStore(opts ...Option) Store {
return NewMemoryStore(opts...) return NewMemoryStore(opts...)
} }
func NewRecord(key string, val interface{}) *Record {
b, _ := json.Marshal(val)
return &Record{
Key: key,
Value: b,
}
}