TableInterface
public protocol TableInterface
Convenient interface for table related operation
-
create(table:of:)Default implementationCreate table, related indexes and constraints with specific type
Note that it will create defined indexes automatically. The name of index is
"\(tableName)\(indexSubfixName)"whileindexSubfixNameis defined byIndexBinding. BUT, it will not drop the undefined indexes. You should drop it manually.Note that it will add the newly defined column automatically. AND, it will skip the undefined column. It can be very developer-friendly while upgrading your database column.
Note that it will run embedded transaction
The embedded transaction means that it will run a transaction if it’s not in other transaction, otherwise it will be executed within the existing transaction.Throws
ErrorDefault Implementation
Declaration
Swift
func create<Root: TableEncodable>(table name: String, of rootType: Root.Type) throwsParameters
nameTable name.
rootTypeType of table encodable object
-
create(virtualTable:of:)Default implementationCreate virtual table and constraints with specific type
Note that it will run embedded transaction
The embedded transaction means that it will run a transaction if it’s not in other transaction, otherwise it will be executed within the existing transaction.Throws
ErrorDefault Implementation
Declaration
Swift
func create<Root: TableEncodable>(virtualTable name: String, of rootType: Root.Type) throwsParameters
nameTable name.
rootTypeType of table encodable object
-
Create table manually
Throws
ErrorDeclaration
Swift
func create(table name: String, with columnDefList: [ColumnDef], and constraintList: [TableConstraint]?) throwsParameters
nameTable name
columnDefListWINQ column definition list
constraintListWINQ constraint list.
-
Create table manually
Throws
ErrorDeclaration
Swift
func create(table name: String, with columnDefList: ColumnDef..., and constraintList: [TableConstraint]?) throwsParameters
nameTable name
columnDefListWINQ column definition list
constraintListWINQ constraint list.
-
addColumn(with:forTable:)Default implementationCreate new column
Throws
ErrorDefault Implementation
Declaration
Swift
func addColumn(with columnDef: ColumnDef, forTable table: String) throwsParameters
columnDefWINQ column definition
tableTable name
-
drop(table:)Default implementationDrop table
Throws
ErroDefault Implementation
Declaration
Swift
func drop(table name: String) throwsParameters
nameTable name
-
Create index manually
Throws
ErrorDeclaration
Swift
func create(index name: String,Parameters
nameIndex name
columnIndexConvertibleListWINQ column index list
tableTable name
-
Create index manually
Throws
ErrorDeclaration
Swift
func create(index name: String,Parameters
nameIndex name
columnIndexConvertibleListWINQ column index list
tableTable name
-
drop(index:)Default implementationDrop index
Throws
ErrorDefault Implementation
Declaration
Swift
func drop(index name: String) throwsParameters
nameIndex name
View on GitHub
Install in Dash
TableInterface Protocol Reference