TableIndex class final

Annotations for Dart table classes to define a SQL index to add to the table.

@TableIndex(name: 'item_title', columns: {#title})
class TodoItems extends Table {
  IntColumn get id => integer().autoIncrement()();
  TextColumn get title => text()();
  TextColumn get content => text().nullable()();
}
Annotations
  • @Target({TargetKind.classType})

Constructors

TableIndex({required String name, required Set<Symbol> columns, bool unique = false})
An annotation for Dart-defined drift tables telling drift to add an SQL index to the table.
const
TableIndex.sql(String createIndexStatement)
An annotation for Dart-defined drift tables telling drift to add an index defined by a createIndexStatement.
const

Properties

columns Set<Symbol>
The columns of the table that should be part of the index.
final
createIndexStatement String?
As an alternative to name, unique and columns, a CREATE INDEX SQL statement defining the index.
final
hashCode int
The hash code for this object.
no setterinherited
name String
The name of the index in SQL.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unique bool
Whether this index is UNIQUE, meaning that the database will forbid multiple rows in the annotated table from having the same values in the indexed columns.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited