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

Handle Fields with default values #4

Open
agenovese opened this issue Aug 3, 2016 · 0 comments
Open

Handle Fields with default values #4

agenovese opened this issue Aug 3, 2016 · 0 comments

Comments

@agenovese
Copy link
Contributor

Looking for feedback, we need to decide how we want to handle/represent fields with default values.

Options:

  • Try to extract the default value from the org.jooq.Table
    • Has the advantage that the client code can use the value of the field before the instance is persisted
    • Is pretty complex, and possibly wouldn't work in all circumstances. The default value is an SQL expression, not sure if it can depend on the other values in the object or even on values in other tables.
  • Use an Option for the field, and have none indicate a desire to leave the field out
    • Simple, matches the behaviour of nullable fields
    • Hard to distinguish from a nullable field
    • not symmetrical, a fetched row with the default value doesn't look like a new row with the default value
  • Use an Either[Unit, T] or similar, with the lhs representing a default value and the rhs representing a set value
    • Seems inelegant
    • no ability to use the default value before storage
    • not symmetrical, a fetched row with the default value doesn't look like a new row with the default value
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