chore(aof): update aof codec

This commit is contained in:
bandl 2021-11-01 21:55:50 +08:00
parent ce888a1d0e
commit 170ba44d2d
2 changed files with 6 additions and 6 deletions

View File

@ -12,10 +12,10 @@ import (
protobuf "google.golang.org/protobuf/proto"
)
type codec struct {
type codecProto struct {
}
func (c codec) Encode(method string, m protobuf.Message) ([]byte, error) {
func (c *codecProto) Encode(method string, m protobuf.Message) ([]byte, error) {
buf, err := protobuf.Marshal(m)
if err != nil {
return nil, err
@ -30,7 +30,7 @@ func (c codec) Encode(method string, m protobuf.Message) ([]byte, error) {
return buffer.Bytes(), nil
}
func (c codec) Decode(buf []byte) (protobuf.Message, error) {
func (c *codecProto) Decode(buf []byte) (protobuf.Message, error) {
hexBuf := bytes.Split(buf, []byte(":"))
if len(hexBuf) != 2 {
return nil, errorx.New("decode aof err: not a valid aof")

View File

@ -12,10 +12,10 @@ import (
protobuf "google.golang.org/protobuf/proto"
)
type codec struct {
type codecProto struct {
}
func (c codec) Encode(method string, m protobuf.Message) ([]byte, error) {
func (c *codecProto) Encode(method string, m protobuf.Message) ([]byte, error) {
buf, err := protobuf.Marshal(m)
if err != nil {
return nil, err
@ -30,7 +30,7 @@ func (c codec) Encode(method string, m protobuf.Message) ([]byte, error) {
return buffer.Bytes(), nil
}
func (c codec) Decode(buf []byte) (protobuf.Message, error) {
func (c *codecProto) Decode(buf []byte) (protobuf.Message, error) {
hexBuf := bytes.Split(buf, []byte(":"))
if len(hexBuf) != 2 {
return nil, errorx.New("decode aof err: not a valid aof")