postgres_builder 2.3.0
postgres_builder: ^2.3.0 copied to clipboard
A tool designed to make writing PostgreSQL statements easier without writing them by hand.
Postgres Builder #
A tool designed to make writing SQL statements easier.
Usage #
To start, create an instance of PostgresBuilder
to run your queries. There is an included PgPoolPostgresBuilder
that uses the postgres_pool package, but you can create your own by extending PostgresBuilder
.
To create SQL strings, create Statement
s, one of
Select
Insert
Update
Delete
Upsert
(insert unless the entity already exists, then update)
Available Methods #
execute
: run a statement and return nothing backquery
: run a query an get all the rows back asMap<String, dynamic>
singleQuery
: run a query and get a single row back asMap<String, dynamic>
mappedQuery
: run a query and get back rows parsed using your providedfromJson
functionmappedSingleQuery
: run a query and get a single row parsed using your providedfromJson
function
Raw Queries #
For all available methods, just add raw
to the name to pass in a raw SQL string instead of a Statement.