phorm_annotations library

Classes

Attributes
Interface for attribute filtering in queries (columns selection).
BelongsTo
The inverse side of a relationship: this table holds the foreign key.
BIGINT
BIGINT type (e.g. 64-bit integer).
BLOB
BLOB binary large object type.
BOOLEAN
BOOLEAN type.
Collate
SQLite collation sequences.
Column
Standard column definition.
ColumnBase
Base class for all column definitions.
CustomSqlValidator
Generic SQL validator that accepts a raw SQL condition.
DATE
DATE type.
DECIMAL
DECIMAL type with custom precision and scale.
DOUBLE
DOUBLE precision floating point type.
Factory<T extends Model>
Interface for model factories. Used to generate mock data for testing or seeding.
HasMany
Relationship definitions
HasOne
A one-to-one relationship where the related table holds the foreign key.
ID
Primary key column.
IJsonValidator
JSON validation check (No SQL generation).
Includable
Base interface for specifying relationships to include in a query.
Index
Database index definition.
INTEGER
INTEGER type (e.g. 32-bit integer).
IResult<T>
Base contract for query results.
ISqlValidator
CHECK constraint validation check (SQL generation).
IValidator
Base interface for check conditions (CHECK constraints).
Join
Alias of BelongsTo kept for query-join readability.
JSON
JSON type.
JSONB
PostgreSQL-specific SQL types.
ManyToMany
A many-to-many relationship resolved through a pivot table.
MigrationBuilder<T extends Model>
Fluent builder for creating migration sequences. Provides type-safe methods for common migration operations.
Model
MODELS 🏗️
NoEscapeDialect
Default dialect that does not escape identifiers and uses positional '?' placeholders.
NUMERIC
SQLite-specific SQL types and helpers.
ParamIndex
Parameter index holder to track sequential placeholders during SQL compilation.
PhormColumn<T>
A typed representation of a database column. Used for building type-safe queries.
PhormCondition
Represents a single SQL condition built from a column and an operator.
PhormConditionGroup
A group of PhormConditions joined by AND or OR.
PhormConsoleLogger
A default colored console logger for PHORM.
PhormDatabaseExecutor
Simple interface for database execution to avoid direct dependency on sqlite3 in the platform interface. This allows the generator to be pure Dart.
PhormLogger
Interface for PHORM logging.
REAL
REAL type.
ReferentialAction
Standard SQLite referential actions for foreign keys. Used in Relationship for onDelete and onUpdate.
Relationship
Base class for relationship annotations between two models.
Result<T>
A plain list result.
ResultWithCount<T>
A result carrying the total row count alongside data.
Schema
Table-level schema configuration.
SqlDialect
Interface defining SQL syntax generation rules for a specific database dialect.
SqlFunc
Annotation to mark a custom Dart function as a SQLite custom function.
SqlType
Abstract interface/class representing all SQL-compatible database data types.
SqlTypes
Standard SQLite type-name string constants.
Table<T extends Model>
Represents a fully generated table schema.
TableMigration<T extends Model>
Represents a single migration operation for a table.
TEXT
TEXT type.
TIME
TIME type.
TIMESTAMP
TIMESTAMP / DATETIME type.
ValueConverter<T, S>
Base class for converting between a Dart type T and a database-compatible type S.
VARCHAR
SQL data types available across all supported dialects (SQLite, PostgreSQL, MySQL / MariaDB).

Enums

ColumnNamingStrategy
Strategy for naming database columns.
SqlDialectKind
Target SQL dialect for schema (DDL) generation.

Extensions

PhormColumnExtension on PhormColumn<T>
Extensions for PhormColumn to enable fluent query building.

Functions

phormDecodeJson(Object? value) Object?
Decodes a raw column value that may carry serialized JSON (nested object columns, aggregated relationship columns): JSON-looking strings are parsed, everything else is returned as-is. Mirrors the map-based read path.

Typedefs

PhormRowBinder<T> = T Function(List<Object?> row) Function(Map<String, int> columnIndex)
Positional row factory: given the result set's column name → index map (resolved once per query), returns a per-row function that builds the model by reading values directly from the positional List — no per-row map construction or string-keyed lookups.

Exceptions / Errors

PhormCHECKValidatorException
Exception thrown when a Dart-side validation fails.
PhormJSONValidatorException
Exception thrown when a Dart-side validation fails.