Sql class

A description of a SQL query as interpreted by this package.

This includes the SQL string to send to the database and known data types for parameters, if any.

Queries can be sent to postgres as-is. To do that, pass a string to Session.prepare or Session.execute or use the default Sql constructor. These queries are not intepreted or altered by this package in any way. If you're using parameter in those queries, you either have to specify their types in the Sql constructor, or exclusively use TypedValue instances in Session.execute, Statement.bind and Statement.run.

Alternatively, you can use named variables that will be desugared by this package with the Sql.named factory. If you prefer positional variables, but want to specify their types in text or use a different symbol for variables (Postgres uses $), you can use the Sql.indexed constructor instead.

Constructors

Sql(String sql, {List<Type<Object>>? types})
The default constructor, sending sql to the Postgres database without any modification.
factory
Sql.indexed(String sql, {String substitution})
Looks for positional parameters in sql and desugars them.
factory
Sql.named(String sql, {String substitution})
Looks for named parameters in sql and desugars them.
factory

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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