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

Supporting a new type in SeaQuery #714

Open
tyt2y3 opened this issue Oct 11, 2023 · 0 comments
Open

Supporting a new type in SeaQuery #714

tyt2y3 opened this issue Oct 11, 2023 · 0 comments

Comments

@tyt2y3
Copy link
Member

tyt2y3 commented Oct 11, 2023

Not exactly an issue, but a guide on how to support a new type in SeaQuery.

  1. It usually starts from ColumnType where we'd add the type, so that it can be used in schema statements
  2. If the type has a native representation (like UUID), we can add a variant to the enum Value (and ArrayType) and implement all necessary traits (ValueType)
  3. we should also determine the JSON serialisation (most likely string) which is implemented in sea_value_to_json_value
  4. Feature guards i.e. #[cfg(feature = "with-uuid")] are needed
  5. We shouldn't depend on sqlx directly in the sea-query crate, so if a type is only defined in sqlx, we have to copy the struct and put it inside sea-query
  6. In sea-query-binder & sea-query-postgres, we then perform the type conversion and binding
  7. Finally, in sea-orm, we should implement TryGetable for the right backend

Reference:

(ipnetwork)
#309
#364
#503

(time)
#267
SeaQL/sea-orm#602

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