Skip to content
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

Fix int marshal, unmarshall #290

Merged
merged 3 commits into from
Oct 5, 2024

Conversation

illia-li
Copy link

@illia-li illia-li commented Oct 3, 2024

Fixed for int type:

  1. string marshal and unmarshal as nullable.
    1.1. Before: marshals "" - caused an error; unmarshals nil data into "0".
    1.2. Now: marshals and unmarshals nil data - "".
  2. custom string marshals and unmarshals, before not supported, now supported.
  3. big.Int marshals, before not supported, now supported.
  4. Marshal data, which equal math.MaxUint32, into uint32, uint64, uint, return error' before, now no error`.
  5. Unmarshal data with the length is different from 0 and 4, did not return error before, now it returns `error'.

Close issues for int:

  1. Marshal, unmarshal. For many cql types unmarshaling data that have bigger len than cql type, do not return an error. #246
  2. Marshal, unmarshal. For many cql types a go string is supported, but not a go custom string #243
  3. Marshal, unmarshal. cql types: tinyint, smallint, int can not be marshaled into go big.Int #244
  4. Marshal, unmarshal. Problems with zero and null data and values. #250
  5. Marshal, unmarshal. For many cql types unmarshaling data that have smaller len than cql type, do not return an error. #252

marshal/int/marshal.go Outdated Show resolved Hide resolved
marshal.go Outdated
@@ -20,6 +20,7 @@ import (

"gopkg.in/inf.v0"

cqlint "github.com/gocql/gocql/marshal/int"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this cqlint needed, can you just use int similarly to smallint and tinyint?

Copy link
Author

@illia-li illia-li Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because identifier int already busy

Copy link
Collaborator

@sylwiaszunejko sylwiaszunejko Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so maybe rename the package to cqlint to not have this thing here

Copy link
Collaborator

@sylwiaszunejko sylwiaszunejko Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkropachev what do you think? cqlint "github.com/gocql/gocql/marshal/int" is better or "github.com/gocql/gocql/marshal/cqlint"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@sylwiaszunejko sylwiaszunejko merged commit f9eeb86 into scylladb:master Oct 5, 2024
1 check passed
@illia-li illia-li deleted the il/fix/marshal/int branch October 7, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants