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

Allow custom CBOR encoding/decoding replacer #387

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lkwr
Copy link
Contributor

@lkwr lkwr commented Dec 8, 2024

Thank you for submitting this pull request! We appreciate you spending the time to work on these changes.

What is the motivation?

I'm currently building an ORM/ODM for SurrealDB in TypeScript, which I want to open source soon (hopefully this year). For the underlying connection to the database, I use surrealdb.js. But types like RecordId or Table are reimplemented so I can provide a much deeper integration in the whole library.

And there comes the problem: Currently before passing the query to surrealdb.js I have a convert step which converts all "custom types" to surrealdb.js equivalents. It would be faster and more flexible when I'm able to overwrite the default CBOR encoding/decoding behaviour.

What does this change do?

So this PR does exactly that, it provides a way to overwrite the default CBOR encoding/decoding replacer. I also export the default replacer, so its much easier to add custom types on top of the default ones.

What are your thoughts on this?

What is your testing strategy?

--

Is this related to any issues?

--

Have you read the Contributing Guidelines?

@lkwr lkwr requested a review from kearfy as a code owner December 8, 2024 13:17
@lkwr lkwr force-pushed the lkwr/custom-cbor branch from 7b43114 to 5331505 Compare December 8, 2024 13:26
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.

1 participant