Core\Db\Column::Type
Says what a result column was declared as in the database.
Core\Db\Column::Type is declared in the class Core\Db\Column. The method type returns it.
Every query result describes its columns, and this enum is the type part of that description. It describes the column, not the values. A column declared as JSON and a column declared as text both give text values, and this type tells them apart.
There is one case for each kind of column that Novis has its own type for. These are whole numbers, exact decimals, text, raw bytes, booleans, the four date and time types, UUIDs and JSON. Other is for everything else, including every array column. A program that shows, exports or pages through rows reads this type to decide how to handle each column. It does not need to guess from the values.
Good to know: the cases are not ordered, so one case is not greater than another. A database with no JSON type of its own reports its JSON columns as text.
Examples
What each column was declared as
<?nvs// `Core\Db\Column::Type` is the type a column was declared with in the database.// This program prints every case and what it means.
class Describe{ public static function plainly(Core\Db\Column::Type $type): string { return match ($type) { Core\Db\Column::Type::Int => 'Int is a whole number, which may be negative', Core\Db\Column::Type::Uint => 'Uint is a whole number that is never negative', Core\Db\Column::Type::Float => 'Float is a number with a fractional part, rounded', Core\Db\Column::Type::Decimal => 'Decimal is an exact amount, such as a price', Core\Db\Column::Type::Text => 'Text is text', Core\Db\Column::Type::Bytes => 'Bytes is raw bytes, such as a stored file', Core\Db\Column::Type::Bool => 'Bool is true or false', Core\Db\Column::Type::Date => 'Date is a calendar day, with no time on it', Core\Db\Column::Type::Time => 'Time is a time of day, with no date on it', Core\Db\Column::Type::DateTime => 'DateTime is a date and a time, with no time zone', Core\Db\Column::Type::Instant => 'Instant is a moment in time, carrying its own offset', Core\Db\Column::Type::Uuid => 'Uuid is a UUID', Core\Db\Column::Type::Json => 'Json is text the database knows is JSON', Core\Db\Column::Type::Other => 'Other is anything else, including every array column', }; }}
array<Core\Db\Column::Type> $everything = [ Core\Db\Column::Type::Int, Core\Db\Column::Type::Uint, Core\Db\Column::Type::Float, Core\Db\Column::Type::Decimal, Core\Db\Column::Type::Text, Core\Db\Column::Type::Bytes, Core\Db\Column::Type::Bool, Core\Db\Column::Type::Date, Core\Db\Column::Type::Time, Core\Db\Column::Type::DateTime, Core\Db\Column::Type::Instant, Core\Db\Column::Type::Uuid, Core\Db\Column::Type::Json, Core\Db\Column::Type::Other,];
foreach ($everything as Core\Db\Column::Type $type) { echo Describe::plainly($type), "\n";}
// A Text column and a Json column both give your program a string.// They are still different cases, so this prints `no`.echo 'Text and Json are the same case: ', Core\Db\Column::Type::Text == Core\Db\Column::Type::Json ? 'yes' : 'no', "\n";Int is a whole number, which may be negativeUint is a whole number that is never negativeFloat is a number with a fractional part, roundedDecimal is an exact amount, such as a priceText is textBytes is raw bytes, such as a stored fileBool is true or falseDate is a calendar day, with no time on itTime is a time of day, with no date on itDateTime is a date and a time, with no time zoneInstant is a moment in time, carrying its own offsetUuid is a UUIDJson is text the database knows is JSONOther is anything else, including every array columnText and Json are the same case: noLining a table up on screen
<?nvs// A table on screen reads better when numbers line up on the right and words// start on the left. The column description says which is which, so your// program decides once per column instead of looking at every cell.
class Table{ public static function alignment(Core\Db\Column::Type $type): string { return match ($type) { Core\Db\Column::Type::Int => 'right', Core\Db\Column::Type::Uint => 'right', Core\Db\Column::Type::Float => 'right', Core\Db\Column::Type::Decimal => 'right', default => 'left', }; }}
// What the description of a `select id, customer, total, placed_on` would// hand back.array<string> $names = ['id', 'customer', 'total', 'placed_on'];array<Core\Db\Column::Type> $types = [ Core\Db\Column::Type::Uint, Core\Db\Column::Type::Text, Core\Db\Column::Type::Decimal, Core\Db\Column::Type::Date,];
foreach (Core\Arr::range(0, 3) as int $column) { echo $names[$column], ' is aligned ', Table::alignment($types[$column]), "\n";}
// A date is a value with an order, and it still goes on the left: what is// being asked here is how the column is read, not how it is sorted.id is aligned rightcustomer is aligned lefttotal is aligned rightplaced_on is aligned leftExporting a report somebody opens in a spreadsheet
<?nvs// This program plans an export to a file that somebody opens in a spreadsheet.// The type of each column decides how that column is written to the file.
class Export{ // `rule` returns how a column of this type is written. It uses the column // type and not the first row, so an empty result still gets a correct header. public static function rule(Core\Db\Column::Type $type): string { return match ($type) { Core\Db\Column::Type::Bytes => 'left out, with the size written instead', Core\Db\Column::Type::Date => 'written as 2026-09-18', Core\Db\Column::Type::DateTime => 'written as 2026-09-18 14:05:00', Core\Db\Column::Type::Instant => "written in the reader's own time zone", Core\Db\Column::Type::Json => 'flattened to one line', Core\Db\Column::Type::Other => 'left out, because nothing here knows what it is', default => 'written as it reads', }; }
// `carried` returns `true` if the column goes into the file. // The last line prints how many columns do. Here it prints `4 of 5`. public static function carried(Core\Db\Column::Type $type): bool { return $type != Core\Db\Column::Type::Bytes && $type != Core\Db\Column::Type::Other; }}
array<string> $names = ['invoice_no', 'issued_on', 'total', 'meta', 'scan'];array<Core\Db\Column::Type> $types = [ Core\Db\Column::Type::Text, Core\Db\Column::Type::Date, Core\Db\Column::Type::Decimal, Core\Db\Column::Type::Json, Core\Db\Column::Type::Bytes,];
uint $carried = 0;foreach (Core\Arr::range(0, 4) as int $column) { echo $names[$column], ': ', Export::rule($types[$column]), "\n"; if (Export::carried($types[$column])) { $carried = $carried + 1; }}
echo $carried, ' of ', Core\Arr::count($names), " columns go into the file\n";invoice_no: written as it readsissued_on: written as 2026-09-18total: written as it readsmeta: flattened to one linescan: left out, with the size written instead4 of 5 columns go into the file