fix parameter unmarshal

This commit is contained in:
Aleksandr Trushkin
2024-02-04 21:57:25 +03:00
parent 60522a7391
commit 4533b90e4a
2 changed files with 13 additions and 5 deletions

View File

@ -31,7 +31,7 @@ func newGoodsItemClient(db *badger.DB, serializeAsJSON bool) *goodsItemClient {
s = goodsItemJSONSerializer{}
} else {
s = goodsItemFlatbufSerializer{}
}
return &goodsItemClient{
db: db,
s: s,
@ -313,7 +313,12 @@ type itemSerializer[T any] interface {
type goodsItemJSONSerializer struct{}
func (goodsItemJSONSerializer) Serialize(in entity.GoodsItem) ([]byte, error) {
return json.Marshal(in)
data, err := json.Marshal(in)
if err != nil {
return nil, fmt.Errorf("marshalling data: %w", err)
}
return data, nil
}
func (goodsItemJSONSerializer) Deserialize(data []byte) (in entity.GoodsItem, err error) {