comon_orm_sqlite 0.0.1-alpha.1 copy "comon_orm_sqlite: ^0.0.1-alpha.1" to clipboard
comon_orm_sqlite: ^0.0.1-alpha.1 copied to clipboard

SQLite adapter for comon_orm with embedded runtime, rebuild-based migrations, and schema introspection.

example/main.dart

import 'dart:io';

import 'generated/comon_orm_client.dart';

Future<void> main() async {
  const databasePath = 'example/example.db';
  _requireExistingDatabase(databasePath);
  final client = await _openClient(databasePath: databasePath);
  try {
    final user = await client.user.create(
      data: const UserCreateInput(email: 'alice@example.com', name: 'Alice'),
    );

    print('created: ${user.email}');
  } finally {
    await client.close();
  }
}

Future<GeneratedComonOrmClient> _openClient({required String databasePath}) {
  return GeneratedComonOrmClientSqlite.open(databasePath: databasePath);
}

void _requireExistingDatabase(String databasePath) {
  if (File(databasePath).existsSync()) {
    return;
  }

  throw StateError(
    'Missing SQLite database at $databasePath. '
    'Create it through the migration/apply tooling before running this example.',
  );
}
0
likes
0
points
185
downloads

Documentation

Documentation

Publisher

verified publisherserezhia.ru

Weekly Downloads

SQLite adapter for comon_orm with embedded runtime, rebuild-based migrations, and schema introspection.

Repository (GitHub)
View/report issues

Topics

#orm #prisma #sqlite #migrations #codegen

License

unknown (license)

Dependencies

comon_orm, sqlite3

More

Packages that depend on comon_orm_sqlite