module
Prostore::TUI::ColumnTypes
Overview
Pure column-type detection and value interpretation.
All functions take primitives (portable type tag, SQL type_text, raw string values) so callers needn't pass widget state. Use this anywhere the UI needs to ask "is this a bool / time / how do I render its value?"
Defined in:
prostore/tui/column_types.crClass Method Summary
-
.bool?(portable_type : String | Nil, type_text : String) : Bool
True if the column stores booleans.
-
.bool_display(val : String) : String
Canonical human-readable bool form.
-
.bool_truthy?(val : String | Nil) : Bool
Interpret common truthy representations.
-
.decimal?(portable_type : String | Nil, type_text : String) : Bool
True if the column stores a fixed-precision decimal.
-
.enum?(portable_type : String | Nil) : Bool
True if the column stores a native Crystal enum (either backed by member name as TEXT —
enum_string— or by underlying int —enum_int). - .enum_int?(portable_type : String | Nil) : Bool
- .enum_string?(portable_type : String | Nil) : Bool
-
.float?(portable_type : String | Nil, type_text : String) : Bool
True if the column stores a binary floating-point number (Float32/Float64).
-
.int?(portable_type : String | Nil, type_text : String) : Bool
True if the column stores an integer.
-
.numeric?(portable_type : String | Nil, type_text : String) : Bool
True if the column stores any numeric value — int, float, or decimal.
-
.searchable_text?(portable_type : String | Nil, type_text : String) : Bool
True if the column stores free-form text suitable for LIKE search.
-
.time?(portable_type : String | Nil, type_text : String) : Bool
True if the column stores a date / time / timestamp.
Class Method Detail
True if the column stores booleans. Prefers the prostore portable type tag; otherwise inspects the SQL type text.
Interpret common truthy representations. Used to normalise across SQLite (0/1), Postgres (true/false), and user input ("yes"/"on"/…).
True if the column stores a fixed-precision decimal.
True if the column stores a native Crystal enum (either backed by
member name as TEXT — enum_string — or by underlying int — enum_int).
See ADR-0016. Pure portable-type check; no SQL type_text fallback
since enums are a prostore-only concept and never appear in unmanaged
databases.
True if the column stores a binary floating-point number (Float32/Float64).
True if the column stores an integer. Prefers the portable type tag; otherwise inspects the SQL type text for the common integer families.
True if the column stores any numeric value — int, float, or decimal.
True if the column stores free-form text suitable for LIKE search. Prefers the prostore portable type tag ("string"); otherwise falls back to inspecting the SQL type text for the common text families. Intentionally narrow — UUID / JSON / etc. are excluded for now.
True if the column stores a date / time / timestamp.