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

enum custom TypeConverters not working #735

Closed
zhangruiyu opened this issue Feb 15, 2023 · 11 comments
Closed

enum custom TypeConverters not working #735

zhangruiyu opened this issue Feb 15, 2023 · 11 comments

Comments

@zhangruiyu
Copy link

image
image
image
image
I have defined the Converter as documented, but it has no effect on the enumeration

@zhangruiyu
Copy link
Author

image
I think that's the right answer, but that's not what's being generated so far

@dkaera
Copy link
Collaborator

dkaera commented Feb 15, 2023

@zhangruiyu good catch
TypeConverters has a lower priority than supported Dart types. Since floor supports Dart enumerations out of the box, you cannot override this. I think we can change this rule it in the next release.

@dkaera
Copy link
Collaborator

dkaera commented Feb 15, 2023

@zhangruiyu
but in any case, floor supports Dart enumerations without TypeConverter and stores them in the appropriate column with int type. If that's fine with you, you don't have to declare TypeConverter for enumerations.

@zhangruiyu
Copy link
Author

@zhangruiyu
but in any case, floor supports Dart enumerations without TypeConverter and stores them in the appropriate column with int type. If that's fine with you, you don't have to declare TypeConverter for enumerations.

Normally this is fine, but dart now supports byname, which can be problematic if the enumeration changes with version updates (for example, adding a new enumeration between two)

@zhangruiyu
Copy link
Author

As you said earlier, type converter should have a higher priority

@zhangruiyu
Copy link
Author

image
image
For example isar, which I think the floor should support

@dkaera
Copy link
Collaborator

dkaera commented Mar 4, 2023

Oh, that's a good one.
I was just thinking about how to implement backward compatibility support.
Not sure about the second option ordinal32. The value of any column can be null if necessary. The number of enum declarations can be unlimited, at least I have not found any limit. What is the benefit of this approach?

@taosimple
Copy link

I have the same issue, after upgrade code is broken, is there any work around.

@dkaera
Copy link
Collaborator

dkaera commented Mar 4, 2023

PR that changes TypeConverters priority is ready for review. #740
Default String converters support will be later.

@zhangruiyu
Copy link
Author

PR that changes TypeConverters priority is ready for review. #740
Default String converters support will be later.

Great. When will the new version be released, thank you very much

@dkaera
Copy link
Collaborator

dkaera commented Mar 4, 2023

PR that changes TypeConverters priority is ready for review. #740
Default String converters support will be later.

Great. When will the new version be released, thank you very much

as soon as PINCH team approve it. I'm just a contributor 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants