import { QueryBuilder } from "https://deno.land/x/cotton@v0.6.3/mod.ts";
Allows to build complex SQL queries and execute those queries.
Methods
private
addWhereClause(options: { column: string; operator?: WhereOperator; value: any; type: WhereType; })Add new where clause to query
count(column: string, options?: { as?: string; distinct?: boolean; }): QueryBuilder
Count records with given conditions
not(): QueryBuilder
column: string,
operator: WhereOperator,
value: any,
or(): QueryBuilder
column: string,
operator: WhereOperator,
value: any,
order(column: string, direction?: OrderDirection): QueryBuilder
Add an "order by" clause to the query.
replace(data: QueryValues): QueryBuilder
Perform REPLACE
query to the table.
It will look for PRIMARY
and UNIQUE
constraints.
If something matched, it gets removed from the table
and creates a new row with the given values.
toSQL()
Get the actual SQL query string. All the data are replaced by a placeholder. So, you need to also bind the values in order to execute the query.
where(): QueryBuilder
column: string,
operator: WhereOperator,
value: any,