stormberry 0.14.0 copy "stormberry: ^0.14.0" to clipboard
stormberry: ^0.14.0 copied to clipboard

A strongly-typed postgres ORM to provide easy bindings between your dart classes and postgres database.

example/lib/main.dart

import 'package:stormberry/stormberry.dart';

import 'models/account.dart';
import 'models/address.dart';
import 'models/company.dart';
import 'models/latlng.dart';

Future<void> main() async {
  var db = Database(
    port: 2222,
    database: 'dart_test',
    username: 'postgres',
    password: 'postgres',
    useSSL: false,
  );

  db.debugPrint = true;

  await db.companies.deleteOne('abc');

  await db.companies.insertOne(CompanyInsertRequest(
    id: 'abc',
    name: 'Minga',
    addresses: [],
  ));

  await db.accounts.deleteMany([0, 1, 2]);

  var accountId = await db.accounts.insertOne(AccountInsertRequest(
    firstName: 'Test',
    lastName: 'User',
    location: LatLng(1, 2),
    billingAddress:
        BillingAddress(name: 'Test User', street: 'SomeRoad 1', city: 'New York', postcode: '123'),
    companyId: 'abc',
  ));

  var account = await db.accounts.queryUserView(accountId);

  print(account!.id);

  var company = await db.companies.queryFullView('abc');

  print(company!.id);

  await db.close();
}
114
likes
100
points
394
downloads

Publisher

verified publisherschultek.dev

Weekly Downloads

A strongly-typed postgres ORM to provide easy bindings between your dart classes and postgres database.

Repository (GitHub)
View/report issues

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

analyzer, args, build, collection, crypto, dart_style, file, glob, path, postgres, source_gen, yaml

More

Packages that depend on stormberry