postgres_builder 2.3.0 copy "postgres_builder: ^2.3.0" to clipboard
postgres_builder: ^2.3.0 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(
    endpoint: Endpoint(
      host: 'localhost',
      database: 'postgres',
    ),
  );

  final users = await builder.mappedQuery(
    Select(
      [
        const Column.star(),
      ],
      from: 'users',
      where: (const Column('name').equals('John') &
                  const Column('age').equals(20)) &
              const Column('age').between(18, 25) |
          (const Column('name').lessThan('Jane') &
              const Column('age').greaterThan(25)),
      order: [const Column('age').ascending()],
    ),
    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
494
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

collection, json_annotation, meta, postgres, recase

More

Packages that depend on postgres_builder