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

docs: EXPOSED-578 Extend the Entity definition topic and add examples #2302

Merged
merged 3 commits into from
Nov 15, 2024

Conversation

vnikolova
Copy link
Collaborator

Description

Extended the Entity definition topic in the following ways:

  • Added new sections with more detailed documentation for Entity type, EntityClass, Properties, Immutable entities and Class method overrides.
  • Added code examples to the exposed-dao project for method overrides and immutable entities.
  • Moved the content from the Field transformation topic to Entity definition as a separate sub-section.

Type of Change

Please mark the relevant options with an "X":

  • Bug fix
  • New feature
  • Documentation update

Related Issues

EXPOSED-578

@vnikolova vnikolova self-assigned this Nov 11, 2024
@vnikolova vnikolova requested review from bog-walk and joc-a November 11, 2024 17:46
Comment on lines 213 to 217
class EntityWithUInt : IntEntity() {
var uint: UInt by TableWithUnsignedInteger.uint.transform({ it.toInt() }, { it.toUInt() })

companion object : IntEntityClass<EntityWithUInt>()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is missing a few pieces to compile:

class EntityWithUInt(id: EntityID<Int>) : IntEntity(id) {
    var uint: UInt by TableWithUnsignedInteger.uint.transform({ it.toInt() }, { it.toUInt() })

    companion object : IntEntityClass<EntityWithUInt>(TableWithUnsignedInteger)
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed and moved to a separate entity file. This function seems to be deprecated though. Is there a better example we can show here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the old DAO transform() is currently deprecated but it will not be removed from the API entirely until some issues with caching are fully resolved.
If all goes well, this entire 'Fields transformation' section would become redundant and we could redirect users to the DSL transform section.
But if the issues prove problematic, then it would be good to keep this example up in the event we rollback deprecation (or implement some other DAO-level change).

@vnikolova vnikolova force-pushed the vnikolova/EXPOSED-578 branch from 0ba6734 to 52ae2b8 Compare November 12, 2024 10:09
@bog-walk bog-walk self-requested a review November 12, 2024 15:20
@vnikolova vnikolova merged commit e82ba9c into main Nov 15, 2024
5 checks passed
@vnikolova vnikolova deleted the vnikolova/EXPOSED-578 branch November 15, 2024 17:13
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

Successfully merging this pull request may close these issues.

3 participants