rangeOf

inline fun <T : Any> rangeOf(lowerBound: T? = null, upperBound: T? = null, isLowerInclusive: Boolean = true, isUpperInclusive: Boolean = false, isLowerInfinite: Boolean = lowerBound == null, isUpperInfinite: Boolean = upperBound == null, isLowerNull: Boolean = false, isUpperNull: Boolean = false): Range<T>

Creates a range, inferring the PostgreSQL range type from T.

Resolution goes by subtype and a subtype maps to exactly one range type, so declaring a custom range over a built-in subtype makes unqualified ranges of that element type ambiguous - the highest OID wins, which is always the custom one. Pin the type with withPgType where that matters.

Return

The constructed range.

Parameters

lowerBound

The lower bound value, or null for none.

upperBound

The upper bound value, or null for none.

isLowerInclusive

Whether the lower bound is part of the range.

isUpperInclusive

Whether the upper bound is part of the range.

isLowerInfinite

Whether the range is unbounded below. Defaults to lowerBound == null.

isUpperInfinite

Whether the range is unbounded above. Defaults to upperBound == null.

isLowerNull

Whether the lower bound is present but NULL, as distinct from unbounded.

isUpperNull

Whether the upper bound is present but NULL, as distinct from unbounded.

Type Parameters

T

The type of the range bounds.