postgres_builder 0.3.1 copy "postgres_builder: ^0.3.1" to clipboard
postgres_builder: ^0.3.1 copied to clipboard

A tool designed to make writing PostgreSQL statements easier without writing them by hand.

example/lib/main.dart

// ignore_for_file: unused_local_variable

import 'package:postgres_builder/postgres_builder.dart';

Future<void> main() async {
  final builder = PgPoolPostgresBuilder(
    pgEndpoint: PgEndpoint(
      host: 'localhost',
      database: 'postgres',
    ),
  );

  final users = await builder.mappedQuery(
    const Select(
      [
        Column.star(),
      ],
      from: 'users',
    ),
    fromJson: User.fromJson,
  );

  // use users
}

class User {
  const User({required this.name});

  factory User.fromJson(Map<String, dynamic> json) =>
      User(name: json['name'] as String);

  final String name;
}
1
likes
150
points
151
downloads

Publisher

unverified uploader

Weekly Downloads

A tool designed to make writing PostgreSQL statements easier without writing them by hand.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

json_annotation, meta, postgres, postgres_pool, recase

More

Packages that depend on postgres_builder