Skip to content

Commit

Permalink
Move serializer values to their respective files
Browse files Browse the repository at this point in the history
  • Loading branch information
muzzammilshahid committed Jul 8, 2024
1 parent 792407c commit 23bb971
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions serializers/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/xconnio/wampproto-go/messages"
)

const CBORSerializerValue = 3

var cborEncoder cbor.DecMode //nolint:gochecknoglobals

type CBORSerializer struct{}
Expand Down
7 changes: 0 additions & 7 deletions serializers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ import (
"github.com/xconnio/wampproto-go/messages"
)

const (
JSONSerializerValue = 1
MsgPackSerializerValue = 2
CBORSerializerValue = 3
ProtobufSerializerValue = 16
)

func ToMessage(wampMsg []any) (messages.Message, error) {
messageType, _ := messages.AsInt64(wampMsg[0])
var msg messages.Message
Expand Down
2 changes: 2 additions & 0 deletions serializers/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"github.com/xconnio/wampproto-go/messages"
)

const JSONSerializerValue = 1

type JSONSerializer struct{}

func (j *JSONSerializer) Serialize(message messages.Message) ([]byte, error) {
Expand Down
2 changes: 2 additions & 0 deletions serializers/msgpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"github.com/xconnio/wampproto-go/messages"
)

const MsgPackSerializerValue = 2

type MsgPackSerializer struct{}

func (m *MsgPackSerializer) Serialize(message messages.Message) ([]byte, error) {
Expand Down

0 comments on commit 23bb971

Please sign in to comment.