Boolean field to disable some other fields #4

Open
opened 2025-02-25 21:08:14 +00:00 by xomrk · 0 comments
Owner

Boolean column that enables or disables some other columns which may decrease used space and increase safety without using nullable types.

Definition example of such columns

    val C_Optional1 = context.column("optinal_1", context.types.SOME_TYPE)
    val C_Optional2 = context.column("optinal_2", context.types.nullableOf(context.types.SOME_TYPE))
    val C_Switch = context.switchColumn("switch", this.C_Optional1, this.C_Optional2)

Usage

    if (row[row.uExt.C_Switch]) {
        println(row[row.uExt.C_Optional1]) // Ok
    } else {
        println(row[row.uExt.C_Optional1]) // Error
    }
Boolean column that enables or disables some other columns which may decrease used space and increase safety without using nullable types. ### Definition example of such columns ```kotlin val C_Optional1 = context.column("optinal_1", context.types.SOME_TYPE) val C_Optional2 = context.column("optinal_2", context.types.nullableOf(context.types.SOME_TYPE)) val C_Switch = context.switchColumn("switch", this.C_Optional1, this.C_Optional2) ``` ### Usage ```kotlin if (row[row.uExt.C_Switch]) { println(row[row.uExt.C_Optional1]) // Ok } else { println(row[row.uExt.C_Optional1]) // Error }
xomrk added the
Enhancement proposal
label 2025-02-25 21:08:14 +00:00
xomrk added reference refs/tags/v0.0 2025-02-25 21:09:10 +00:00
xomrk removed reference refs/tags/v0.0 2025-02-25 21:10:46 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: SERDHA/serdha-0-api.kt#4
No description provided.