dsql 1.0.7 copy "dsql: ^1.0.7" to clipboard
dsql: ^1.0.7 copied to clipboard

Dart (PostgresSQL) SQL library for generating .dart files from .sql files and migrating the database based on the .sql files! Inspired by ORMs like Prisma (NodeJs) and SQLC (Golang).

example/lib/example.dart

import 'dart:io';

import 'package:example/generated/dsql.dart';

void main() async {
  final dsql = DSQL.withPool(
    'postgres://postgres:postgres@localhost:5432/dev',
    verbose: true,
  );

  final users = await dsql.users.findMany();

  return users.when(
    (success) {
      print(success);
      exit(0);
    },
    (error) {
      print(error.message);
      exit(0);
    },
  );
  //  Because we are using verbose = true the current query and parameters will be printed in the console
  //  ********************************************************************************
  //  FindManyUserParams
  //  ********************************************************************************
  //  QUERY: SELECT * FROM tb_users OFFSET 0 LIMIT 20;
  //  PARAMETERS: []
  //  ********************************************************************************
  //
  //  Printed data:
  //  [UserEntity(id: da11189a-34cf-4d2e-a507-dac8a8cfe192, name: Tiago Alves, username: tihrasguinho, email: tiago@gmail.com, password: 667623, image: null, bio: Soldado sem braço não faz sentido!, createdAt: 2024-07-30 18:35:44.158241Z, updatedAt: 2024-07-30 18:35:44.158241Z)]
}
4
likes
140
points
27
downloads

Publisher

unverified uploader

Weekly Downloads

Dart (PostgresSQL) SQL library for generating .dart files from .sql files and migrating the database based on the .sql files! Inspired by ORMs like Prisma (NodeJs) and SQLC (Golang).

Repository (GitHub)
View/report issues

Topics

#postgres #orm #prisma #sqlc

Documentation

API reference

License

MIT (license)

Dependencies

args, path, postgres, strings

More

Packages that depend on dsql