Skip to content

Support nullable values in GenericInsertSpec.value()  #162

@rjaros

Description

@rjaros

Currently it's very inconvenient to use insert fluent API with Kotlin nullable variables, because you can't use GenericInsertSpec.value(...) method. Nullable values should be allowed and just passed to nullValue(...) method.

You can workaround the problem with simple Kotlin extension function:

fun <T> DatabaseClient.GenericInsertSpec<T>.safeValue(field: String, value: Any?): DatabaseClient.GenericInsertSpec<T> =
    if (value == null) {
        this.nullValue(field)
    } else {
        this.value(field, value)
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions