SqlBuilder class

SqlBuilder is a class that helps in building SQL queries in a structured manner.

Constructors

SqlBuilder()
Default constructor for the SqlBuilder class.
SqlBuilder.raw({@required required String rawSql})
Named constructor for the SqlBuilder class that accepts a raw SQL query.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build({bool print = false}) String
Builds the SQL query string from the SqlBuilder instance.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryFrom({String table = ''}) SqlBuilder
Adds a 'FROM' clause to the SQL query.
queryJoin({required String table, required String on, String join = 'INNER JOIN'}) SqlBuilder
Adds a 'JOIN' clause to the SQL query.
queryLimit({String limit = ''}) SqlBuilder
Adds a 'LIMIT' clause to the SQL query.
queryOrder({List<List<String>> fields = const []}) SqlBuilder
Adds an 'ORDER BY' clause to the SQL query.
querySelect({List<String> fields = const ['*']}) SqlBuilder
Adds a 'SELECT' statement to the SQL query.
queryWhere({List<String> conditions = const []}) SqlBuilder
Adds a 'WHERE' clause to the SQL query.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

constOperators Map<String, String>
constOperators is a constant map that maps operator names to their SQL equivalents.
final

Static Methods

queryCount({List<String> fields = const ['*'], bool all = true}) String
Creates a 'COUNT' function for the SQL query.
querySubSelect(SqlBuilder sqlBuilder) String
Creates a subselect for the SQL query.