QueryBuilder class

Constructors

QueryBuilder.from({required DB db, required String table})

Properties

db DB
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
table String
getter/setter pair

Methods

avg(String column) Future<double>
Retrieve the average of the values of a given column.
batchInsert(List<Map<String, dynamic>> values) Future<int>
Insert new records into the database.
count() Future<int>
Retrieve the "count" result of the query.
delete() Future<int>
Delete records from the database.
first() Future<Map<String, dynamic>>
Execute the query and get the first result.
get() Future<List<Map<String, dynamic>>>
Execute the query as a "select" statement.
groupBy(dynamic groups) QueryBuilder
Add a "group by" clause to the query.
having(String column, dynamic value, [dynamic operator]) QueryBuilder
Add a "having" clause to the query.
inRandomOrder() QueryBuilder
Put the query's results in random order.
insert(Map<String, dynamic> value) Future<int>
Insert a new record into the database.
leftJoin(String table, String key, String foreignKey) QueryBuilder
Add a left join to the query.
limit(int value) QueryBuilder
Set the "limit" value of the query.
max(String column) Future<int>
Retrieve the maximum value of a given column.
min(String column) Future<int>
Retrieve the minimum value of a given column.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offset(int value) QueryBuilder
Set the "offset" value of the query.
orderBy(String column, [String direction = 'ASC']) QueryBuilder
Add an "order by" clause to the query.
orHaving(String column, dynamic value, [dynamic operator]) QueryBuilder
Add an "or having" clause to the query.
orWhere(String column, dynamic value, [dynamic operator]) QueryBuilder
Add an "or where" clause to the query.
rightJoin(String table, String key, String foreignKey) QueryBuilder
Add a right join to the query.
select([List<String>? columns]) QueryBuilder
Set the columns to be selected.
skip(int value) QueryBuilder
Alias to set the "offset" value of the query.
sole() Future<Map<String, dynamic>>
Execute the query and get the first result if it's the sole matching record.
sum(String column) Future<double>
Retrieve the sum of the values of a given column.
take(int value) QueryBuilder
Alias to set the "limit" value of the query.
toSql() String
Get the SQL representation of the query.
toString() String
A string representation of this object.
inherited
update(Map<String, dynamic> value) Future<int>
Update records in the database.
where(String column, dynamic value, [dynamic operator]) QueryBuilder
Add a basic where clause to the query.

Operators

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