orm 4.0.0-alpha.2 copy "orm: ^4.0.0-alpha.2" to clipboard
orm: ^4.0.0-alpha.2 copied to clipboard

◭ Next-generation ORM for Dart & Flutter | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB.

example/main.dart

import 'package:orm/orm.dart';

import '../prisma/dart/client.dart';
import '../prisma/dart/prisma.dart';

void main() async {
  final prisma = PrismaClient();
  try {
    final user = await prisma.user.findFirstOrThrow(
      select: UserSelect(
        id: true,
        name: true,
        $count: PrismaUnion.$1(true),
      ),
    );

    print(
        'Fond user ${user.name} (ID: ${user.id}), Total posts: ${user.$count?.posts}');

    final users = await prisma.$raw.query('SELECT * FROM "User"');
    print('\n');
    print('Raw Query users:');
    print(users);

    final posts = await prisma.$raw
        .query('SELECT * FROM "Post" WHERE "userId" = \$1', [user.id]);
    print('\n');
    print('Raw Query posts');
    print(posts);
  } catch (_) {
    rethrow;
  } finally {
    await prisma.$disconnect();
  }
}
213
likes
0
pub points
88%
popularity

Publisher

verified publisherodroe.dev

◭ Next-generation ORM for Dart & Flutter | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB.

Homepage
Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

github.com
opencollective.com
www.patreon.com

License

unknown (license)

Dependencies

code_builder, dart_style, decimal, json_rpc_2, path, recase, retry, stream_channel, webfetch

More

Packages that depend on orm