Unset

data object Unset : PatchField<Nothing> (source)

The field was not supplied.

Properties

Link copied to clipboard

True for Value, false for Unset.

Functions

Link copied to clipboard
fun <T> PatchField<T>.nullAs(replacement: T): PatchField<T>

Returns Value of replacement for Value(null), otherwise this field unchanged.

Link copied to clipboard
fun <T> PatchField<T>.orKeep(current: T?): T?

Returns current for Unset, otherwise the supplied value (even when null).

Link copied to clipboard
fun <T> PatchField<T>.orKeepRequired(current: T, fieldName: String): T

Same as orKeep for a field that must never be null.

Link copied to clipboard

Returns the supplied collection, or null if the group must not be touched (PatchField.Unset).

Link copied to clipboard

Same as toTargetIdsOrNull for elements that already are raw ids.

fun <T, R> PatchField<Collection<T>?>.toTargetIdsOrNull(transform: (T) -> R): Set<R>?

Converts this field to the set of target ids a junction relation must be synced to, or null if the relation must not be touched (PatchField.Unset).