-
Notifications
You must be signed in to change notification settings - Fork 60
feat(arrow, datetime, decimal, uuid): add support for go-option #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v3
Are you sure you want to change the base?
Conversation
e3ed24c
to
913ab89
Compare
Converted to draft until go-option v1.0.0 is released. |
913ab89
to
9e1d51b
Compare
9e1d51b
to
c45b36a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the patch.
Tests are missing, we need tests for new functionality in the public API.
arrow/arrow.go
Outdated
func (a Arrow) MarshalMsgpack() ([]byte, error) { | ||
return a.data, nil | ||
} | ||
|
||
func (a *Arrow) UnmarshalMsgpack(data []byte) error { | ||
a.data = data | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add comments to the public API methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
datetime/datetime.go
Outdated
|
||
func (d Datetime) MarshalMsgpack() ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
datetime/datetime.go
Outdated
|
||
func (d *Datetime) UnmarshalMsgpack(data []byte) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
64ac6f6
to
ae84793
Compare
macOS tests won't work for now (will be fixed by #462) |
Add support for `go-option` to the `arrow`, `datetime`, `decimal`, and `uuid` packages. This allows for handling optional values of the `Arrow`, `Datetime`, `Interval`, `Decimal`, `UUID` and `BoxError` types. The following changes have been made: - Added `go:generate` directives to the `Arrow`, `Datetime`, `Interval`, `Decimal`, `UUID` and `BoxError` types to generate optional types using `github.com/tarantool/go-option/cmd/gentypes`. - Implemented `MarshalMsgpack` and `UnmarshalMsgpack` methods for the `Arrow`, `Datetime`, `Interval`, and `Decimal` types. - Added `marshalUUID` and `unmarshalUUID` functions for the `UUID` type. - The generated `_gen.go` files contain the `Optional*` types that wrap the original types and provide methods to handle optional values, including `EncodeMsgpack` and `DecodeMsgpack` for `msgpack` serialization. - Refactored the `datetime` and `decimal` decoders to use the new `UnmarshalMsgpack` methods.
ae84793
to
2cb114b
Compare
Add support for
go-option
to thearrow
,datetime
,decimal
, anduuid
packages. This allows for handling optional values of theArrow
,Datetime
,Interval
,Decimal
, andUUID
types.The following changes have been made:
go:generate
directives to theArrow
,Datetime
,Interval
,Decimal
, andUUID
types to generate optional types usinggithub.com/tarantool/go-option/cmd/gentypes
.MarshalMsgpack
andUnmarshalMsgpack
methods for theArrow
,Datetime
,Interval
, andDecimal
types.marshalUUID
andunmarshalUUID
functions for theUUID
type._gen.go
files contain theOptional*
types that wrap the original types and provide methods to handle optional values, includingEncodeMsgpack
andDecodeMsgpack
formsgpack
serialization.datetime
anddecimal
decoders to use the newUnmarshalMsgpack
methods.Closes #TNTP-3735.