JetBrains / JetBrains/Exposed

Inheritance support with delegation classes.

Open
#1,150 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
9.3k
Forks
798
Avg merge
4d 2h
Merged PRs (30d)
26

Description

Hi

I already have made a pull request about this #1127, but as it was not merged or commented, I closed it, because it is getting a lot of changes over the pull.

Now, I open this issue to keep it documented the needing. If someone wants to suggest anything, is free for do it.

The idea is to make Table as Interface, then we could make something like this:

```
interface SoftDeleteTable {
val deleted: Column
}

fun ITable.withSoftDelete(): SoftDeleteTable = object: SoftDeleteTable, ITable by this {
// Anonymus implementation of SoftDelete that add columns to the current table.
override val deleted = bool("is_active").default(false)
}

open class CountryTable(val table: ITable = Table()): SoftDeleteTable by table.withSoftDelete() {
val name = varchar("name", 255)
val isActive = bool("is_active").default(false)
}

class Country: IntEntity {
object companion Table: CountryTable()

name by Table.name
isActive by Table.isActive
deleted by Table.deleted
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.