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

Example how to setup custom serializers #71

Open
awb99 opened this issue Jan 30, 2022 · 1 comment
Open

Example how to setup custom serializers #71

awb99 opened this issue Jan 30, 2022 · 1 comment

Comments

@awb99
Copy link

awb99 commented Jan 30, 2022

The 'weak' point in clojure is that edn and transit encoding do not bring a lot of default serializers.

Example: date and uuid are not serializable by default, nor are records.

So I think it is essential to Be able to configure serializers for edn and transit in konserve. Could you add a little demo on this? It would also be enough to just add the key that needs to be passed on store initialization into the readme.

A persistence library is a very delicate thing. Once you add it to your project you will live and die with it. I have seen similar problems in clojure http requests and websocket requests. Just knowing that it is possible to work with all types that are used in the project brings peace of mind.

@whilo
Copy link
Member

whilo commented Jan 20, 2023

Date and UUIDs are handled by default in clojure.edn and fressian, and I think also transit (because they are part of the general edn semantics in Clojure). Currently there are two ways to extand handlers, one general one for records with incognito and one by adding custom handlers to each serializer. We in fact use the latter for Datahike and fressian here https://github.com/replikativ/datahike/blob/35773c5882227707a94047a2a97ea8ce5f98c658/src/datahike/index/persistent_set.cljc#L210. It is really just exposing the underlying serialization library handler interface.

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

No branches or pull requests

2 participants