Skip to content

Commit

Permalink
api: make UUID_extId private
Browse files Browse the repository at this point in the history
Part of #158
  • Loading branch information
oleg-jukovec committed May 23, 2023
1 parent 265dab3 commit bee1efa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
- msgpack.v2 support (#236)
- pool/RoundRobinStrategy (#158)
- DeadlineIO (#158)
- UUID_extId (#158)

### Fixed

Expand Down
6 changes: 3 additions & 3 deletions uuid/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
)

// UUID external type.
const UUID_extId = 2
const uuid_extID = 2

func encodeUUID(e *msgpack.Encoder, v reflect.Value) error {
id := v.Interface().(uuid.UUID)
Expand Down Expand Up @@ -63,12 +63,12 @@ func decodeUUID(d *msgpack.Decoder, v reflect.Value) error {

func init() {
msgpack.Register(reflect.TypeOf((*uuid.UUID)(nil)).Elem(), encodeUUID, decodeUUID)
msgpack.RegisterExtEncoder(UUID_extId, uuid.UUID{},
msgpack.RegisterExtEncoder(uuid_extID, uuid.UUID{},
func(e *msgpack.Encoder, v reflect.Value) ([]byte, error) {
uuid := v.Interface().(uuid.UUID)
return uuid.MarshalBinary()
})
msgpack.RegisterExtDecoder(UUID_extId, uuid.UUID{},
msgpack.RegisterExtDecoder(uuid_extID, uuid.UUID{},
func(d *msgpack.Decoder, v reflect.Value, extLen int) error {
return decodeUUID(d, v)
})
Expand Down

0 comments on commit bee1efa

Please sign in to comment.