-
Notifications
You must be signed in to change notification settings - Fork 66
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
Additional CBOR types #160
Conversation
remade
commented
Oct 17, 2024
- Add Custom types with CBOR marshaling/unmarshaling
- Test and fix CBOR inconsistencies
- Add test
Hi, the returning result is Also I'm getting another error For |
Hey @agufagit, for official SurrealDB drivers reaching compatibility with SurrealDB 2.0.0, it is actually expected that values such as Record IDs, datetimes, durations, etc, are no longer represented in a string-like format, but rather in a native manner. Taking record ids as an example, the id parts such as objects and arrays can contain information which the developer might use in it's implementation, which would be difficult to retrieve when all these values are represented in a string-like format. To decode these, you would need to implement the entire surrealql parser, as array and object record ids can contain any surrealql value 😅 All SDKs should implement a stringification method however, and have a way to send record ids as a string. (a Thank you! |
Hi @agufagit With CBOR implemented, all responses are CBOR encoded including the record ID. This is to our advantage. As @kearfy mentioned, there is a |
Hi, I hope this doesn't mean I have to loop every record to call id.String(), dateTime.toTime()? Suppose I have a struct type Data struct {
ID string `json:"id"`
Date time.Time `json:"date"`
} will driver be smart enough to automatically convert id to string, date to time.Time? Or we have to do it ourselves? |
Whenever you are retrieving the ID, when you retrieve the ID, you can simply call the string method
|
that's what I want to avoid to do, my app is fairly complex, that would mean too much work. I'm using auto gen graphql, where ID is string, I'll have to redefine every struct and map it to graphql struct instead of just using auto generated graphql struct but no biggie, once you are done, I'll just fork the repo and make changes, and use that forked repo instead |
@agufagit |
I didn't try the new commit yet, but that sounds great, I'll try it after you're done and new release is out for v2.0.0, thank you. |