ColumnBuilder<T extends Object> class
A column builder is used to specify which columns should appear in a table. All of the methods defined in this class and its subclasses are not meant to be called at runtime. Instead, the generator will take a look at your source code (specifically, it will analyze which of the methods you use) to figure out the column structure of a table.
- Available extensions
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
autoIncrement(
) → ColumnBuilder< BigInt> -
Available on ColumnBuilder<
Enables auto-increment for this column, which will also make this column the primary key of the table.BigInt> , provided by the BuildInt64Column extension -
autoIncrement(
) → ColumnBuilder< T> -
Available on ColumnBuilder<
Enables auto-increment for this column, which will also make this column the primary key of the table.T> , provided by the BuildIntColumn extension -
call(
) → Column< T> -
Available on _BaseColumnBuilder<
Turns this column builder into a column. This method won't actually be called in your code. Instead, the generator will take a look at your source code to figure out your table structure.T> , provided by the BuildGeneralColumn extension -
check(
Expression< bool> condition) → ColumnBuilder<T> -
Available on ColumnBuilder<
Adds aT> , provided by the BuildColumn extensionCHECK
constraint to this column. -
clientDefault(
T onInsert()) → ColumnBuilder< T> -
Available on ColumnBuilder<
Sets a dynamic default value for this column.T> , provided by the BuildColumn extension -
customConstraint(
String constraint) → ColumnBuilder< T> -
Available on ColumnBuilder<
Tells drift to write a custom constraint after this column definition when writing this column, for instance in a CREATE TABLE statement.T> , provided by the BuildColumn extension -
generatedAs(
Expression< T> generatedAs, {bool stored = false}) → VirtualColumnBuilder<T> -
Available on ColumnBuilder<
Declare a generated column.T> , provided by the BuildColumn extension -
map<
Dart> (TypeConverter< Dart, T?> converter) → ColumnBuilder<T> -
Available on _BaseColumnBuilder<
Uses a customT> , provided by the BuildGeneralColumn extensionconverter
to store custom Dart objects in a single column and automatically mapping them from and to sql. -
named(
String name) → ColumnBuilder< T> -
Available on _BaseColumnBuilder<
By default, the field name will be used as the column name, e.g.T> , provided by the BuildGeneralColumn extensionIntColumn get id = integer()
will have "id" as its associated name. Columns made up of multiple words are expected to be in camelCase and will be converted to snake_case (e.g. a getter called accountCreationDate will result in an SQL column called account_creation_date). To change this default behavior, use something likeIntColumn get id = integer((c) => c.named('user_id'))
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
nullable(
) → ColumnBuilder< T> -
Available on _BaseColumnBuilder<
Marks this column as nullable. Nullable columns should not appear in a primary key. Columns are non-null by default.T> , provided by the BuildGeneralColumn extension -
references(
Type table, Symbol column, {KeyAction? onUpdate, KeyAction? onDelete, bool initiallyDeferred = false}) → ColumnBuilder< T> -
Available on ColumnBuilder<
Adds a foreign-key reference from this column.T> , provided by the BuildColumn extension -
toString(
) → String -
A string representation of this object.
inherited
-
unique(
) → ColumnBuilder< T> -
Available on _BaseColumnBuilder<
Adds UNIQUE constraint to column.T> , provided by the BuildGeneralColumn extension -
withDefault(
Expression< T> e) → ColumnBuilder<T> -
Available on ColumnBuilder<
The column will use this expression when a row is inserted and no value has been specified.T> , provided by the BuildColumn extension -
withLength(
{int? min, int? max}) → ColumnBuilder< T> -
Available on ColumnBuilder<
Puts a constraint on the minimum and maximum length of text that can be stored in this column.T> , provided by the BuildTextColumn extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited