The options for the model. All parameters except autoIncrement, withRowId, and uniqueKeys are required.
Optional
D1The D1Orm instance to use - optional. If not set initially, you must use SetOrm() to set before querying.
Optional
autoThe column to use for auto incrementing. If specified, only one primary key is allowed, and must be of type INTEGER.
The primary key or keys of the table.
The name of the table to use.
Optional
uniqueThe unique keys of the table. For example [ ['id'], ['username', 'discriminator'] ]
would cause ID to be unique, as well as the combination of username and discriminator.
Optional
withWhether or not D1 should generate a rowid
column automatically. Defaults to false.
The columns for the model. The keys are the column names, and the values are the column options. See ModelColumn
Readonly
columnsReadonly
primaryReadonly
tableReadonly
uniqueA CreateTable definition for the model, which can be used in a CREATE TABLE statement.
The options for the query, see GenerateQueryOptions
Returns all rows that match the where clause.
The options for creating the table. Currently only contains strategy, which is the strategy to use when creating the table.
The options for the query, see GenerateQueryOptions
The options for the query, see GenerateQueryOptions
Returns the first row that matches the where clause, or null if no rows match.
The data to insert into the table, as an array of objects with the column names as keys and the values as values.
The options for the query, see GenerateQueryOptions
Throws an error if the data clause is empty.
Upserting is a way to insert a row into the table, or update it if it already exists. This is done by using SQLITE's ON CONFLICT clause. As a result, this method should control the primary key for the insert & where clauses, and should not be used with auto incrementing keys.
The options for the query, see GenerateQueryOptions
Generated using TypeDoc
The type of the model, which will be returned when using methods such as First() or All()