• Stars
    star
    128
  • Rank 281,044 (Top 6 %)
  • Language
    Dart
  • License
    BSD 3-Clause "New...
  • Created about 8 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dart PostgreSQL driver: supports extended query format, binary protocol and statement reuse.

postgres

Build Status codecov

A library for connecting to and querying PostgreSQL databases.

This driver uses the more efficient and secure extended query format of the PostgreSQL protocol.

Usage

Create PostgreSQLConnections and open them:

var connection = PostgreSQLConnection("localhost", 5432, "dart_test", username: "dart", password: "dart");
await connection.open();

Execute queries with query:

List<List<dynamic>> results = await connection.query("SELECT a, b FROM table WHERE a = @aValue", substitutionValues: {
    "aValue" : 3
});

for (final row in results) {
  var a = row[0];
  var b = row[1];

} 

Return rows as maps containing table and column names:

List<Map<String, Map<String, dynamic>>> results = await connection.mappedResultsQuery(
  "SELECT t.id, t.name, u.name FROM t LEFT OUTER JOIN u ON t.id=u.t_id");

for (final row in results) {
  var tID = row["t"]["id"];
  var tName = row["t"]["name"];
  var uName = row["u"]["name"];
}

Execute queries in a transaction:

await connection.transaction((ctx) async {
    var result = await ctx.query("SELECT id FROM table");
    await ctx.query("INSERT INTO table (id) VALUES (@a:int4)", substitutionValues: {
        "a" : result.last[0] + 1
    });
});

See the API documentation: https://pub.dev/documentation/postgres/latest/

Features and bugs

Please file feature requests and bugs at the issue tracker.

More Repositories

1

aqueduct

Dart HTTP server framework for building REST APIs. Includes PostgreSQL ORM and OAuth2 provider.
Dart
2,411
star
2

aqueduct_examples

Examples of using Aqueduct, Flutter, Angular2, etc.
Dart
79
star
3

RxEspresso

Filling the gap between RxJava and Espresso
Java
79
star
4

PrimeGrid

Example project for the GridLayout with prime numbers
Swift
46
star
5

dart-codable

A library for converting dynamic, structured data (JSON, YAML) into Dart types.
Dart
38
star
6

dart-k8s

Full stack example Dart application (Angular and Aqueduct) with Docker and Kubernetes
Dart
31
star
7

standardlib

The missing Android framework classes
Java
27
star
8

MenuController

This is the code to go alongside a series of blog posts about iOS container view controllers, beginning here: http://stablekernel.com/blog/view-controller-containers-part-i/
Objective-C
21
star
9

safe_config

A safe and convenient way to read YAML configuration files.
Dart
15
star
10

dart-password-hash

Hashes passwords using PBKDF2.
Dart
15
star
11

kubernetes

k8s bootstrapping
Dockerfile
13
star
12

open-api-dart

OpenAPI (Swagger) data structures in Dart
Dart
12
star
13

dart-isolate-executor

Dart
11
star
14

gradient-fade

Sample Project for adding a gradient fade to a scroll view
Swift
6
star
15

open-api-generator

Dart
5
star
16

DataViewable

Swift
5
star
17

dart-runtime

Package for swapping mirror/code generated runtimes
Dart
5
star
18

swift-repo-layer-example

Swift
5
star
19

scribe

Dart Logging Backends
Dart
5
star
20

Flutter-tutorial

Flutter Project Tutorial
Dart
4
star
21

AndroidContinuousDelivery

Java
3
star
22

dart-test-terminal

Utilities for testing Dart code that uses the filesystem or works with a Dart project directory.
Dart
3
star
23

sandlot

A sandbox viewer for iOS Simulators
Objective-C
2
star
24

dart_aws_sns

Amazon Push/GCM Notification Client in Dart
Dart
2
star
25

dart-kubernetes

Dart definitions for Kubernetes objects
Dart
2
star
26

angulardart-bootstrap-example

An example repository for how to setup an AngularDart + Bootstrap web app hosted on Github Pages
Dart
2
star
27

Armory

Testing framework for iOS
Swift
1
star
28

tutorial_1

Dart
1
star
29

tutorial_3

Dart
1
star
30

tour-of-heroes-dart

Modified version of AngularDart Tour of Heroes for use with Aqueduct tutorial.
Dart
1
star
31

android-example-movetasktoback

Java
1
star
32

tutorial_2

Dart
1
star