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

Make logical types extensible #186

Open
AlexeyRaga opened this issue Aug 11, 2022 · 1 comment
Open

Make logical types extensible #186

AlexeyRaga opened this issue Aug 11, 2022 · 1 comment

Comments

@AlexeyRaga
Copy link
Member

{ "name": "Decimal", "type": {
      "type": "bytes", "logicalType": "decimal", "precision": 7, "scale": 2
}}

As per Avro specification, logical types are optional for codecs to implement.
This library implements "basic" logical types, but they are hard coded into the library.

It would be nice to be able to make logical types extensible so that users of the library would be able to provide their own logical types.

Currently, Java and even .NET implementations allow "registering" new logical types.
We ought to be able to do it, too ;)

@AlexeyRaga
Copy link
Member Author

I wonder if it can be implemented somehow like

class LogicalType (name :: Symbol) baseType haskellType | name -> haskellType where
    fromBaseType :: Schema -> baseType -> Either String haskellType
   ...

and instances.

Questions: how to make TH generator see that and know to generate appropriate logical types?..

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

1 participant