ormed_postgres 0.1.0-dev+4 copy "ormed_postgres: ^0.1.0-dev+4" to clipboard
ormed_postgres: ^0.1.0-dev+4 copied to clipboard

PostgreSQL adapter for the routed ORM driver interface.

example/main.dart

import 'package:ormed/ormed.dart';
import 'package:ormed_postgres/ormed_postgres.dart';

void main() async {
  // 1. Register the PostgreSQL driver
  ensurePostgresDriverRegistration();

  // 2. Define configuration
  final config = OrmProjectConfig(
    activeConnectionName: 'default',
    connections: {
      'default': ConnectionDefinition(
        name: 'default',
        driver: DriverConfig(
          type: 'postgres',
          options: {
            'host': 'localhost',
            'port': 5432,
            'database': 'my_database',
            'username': 'postgres',
            'password': 'password',
          },
        ),
        migrations: MigrationSection(
          directory: 'database/migrations',
          registry: 'database/migrations.dart',
          ledgerTable: 'orm_migrations',
          schemaDump: 'database/schema',
        ),
      ),
    },
  );

  // 3. Create DataSource
  final ds = DataSource.fromConfig(config);

  // 4. Initialize (connects to DB)
  // await ds.init();

  print('PostgreSQL DataSource created: ${ds.options.driver.metadata.name}');
}
0
likes
160
points
30
downloads

Publisher

verified publisherglenfordwilliams.com

Weekly Downloads

PostgreSQL adapter for the routed ORM driver interface.

Repository (GitHub)
View/report issues

Topics

#orm #database #postgres

Documentation

Documentation
API reference

Funding

Consider supporting this project:

www.buymeacoffee.com

License

MIT (license)

Dependencies

carbonized, decimal, meta, ormed, postgres, uuid

More

Packages that depend on ormed_postgres