Logo ProcessCore

SqlValue Module

Helpers for constructing SqlValue instances from primitive values and for extracting strongly-typed values back out, with descriptive errors when the underlying case does not match the expected SQLite storage class.

Functions and values

Function or value Description

SqlValue.asInt column value

Full Usage: SqlValue.asInt column value

Parameters:
    column : string - Logical column name used in error messages.
    value : SqlValue - The value to project.

Returns: int

Extracts a required integer value. Raises ArgumentException if the value is SqlValue.Null or non-integer.

column : string

Logical column name used in error messages.

value : SqlValue

The value to project.

Returns: int

SqlValue.asText column value

Full Usage: SqlValue.asText column value

Parameters:
    column : string - Logical column name used in error messages.
    value : SqlValue - The value to project.

Returns: string

Extracts a required text value. Raises ArgumentException if the value is SqlValue.Null or non-textual; the column name is included in the error so callers can identify the offending column.

column : string

Logical column name used in error messages.

value : SqlValue

The value to project.

Returns: string

SqlValue.asTextOption column value

Full Usage: SqlValue.asTextOption column value

Parameters:
    column : string - Logical column name used in error messages.
    value : SqlValue - The value to project.

Returns: string option

Extracts an optional text value, returning None for SqlValue.Null. Raises if the value is non-textual.

column : string

Logical column name used in error messages.

value : SqlValue

The value to project.

Returns: string option

SqlValue.ofInt value

Full Usage: SqlValue.ofInt value

Parameters:
    value : int

Returns: SqlValue

Wraps an integer as SqlValue.Int.

value : int
Returns: SqlValue

SqlValue.ofTextOption value

Full Usage: SqlValue.ofTextOption value

Parameters:
    value : string option

Returns: SqlValue

Lifts a string option to an SqlValue, mapping None to SqlValue.Null.

value : string option
Returns: SqlValue

Type something to start searching.