athena_sql 1.1.8 copy "athena_sql: ^1.1.8" to clipboard
athena_sql: ^1.1.8 copied to clipboard

Dart SQL query builder, expressive and user-friendly API to build and manage SQL queries in your Dart projects.

AthenaSQL #

A powerful and elegant Dart SQL query builder inspired by the wisdom and strategy of the ancient Greek goddess Athena. AthenaSQL brings the grandeur and might of ancient empires to the digital era, providing an expressive and user-friendly API to build and manage SQL queries in your Dart projects.

AthenaSQL Logo

CI pub package licence melos discord

Features #

  • Chainable and readable API for constructing SQL queries
  • Support for various SQL statements like SELECT, INSERT, UPDATE, DELETE, and CREATE TABLE
  • Advanced query features such as joins, subqueries, aliases, aggregation functions, and more
  • Table creation with columns, data types, and constraints (primary key, foreign key, unique, and check)
  • Extensible architecture to support custom data types and additional features

Installation #

To use Posrgresql or MySql with AthenaSQL, install the following packages:

for posrgresql:

dart pub add athena_postgres

for mysql

dart pub add athena_mysql

they come with athena_sql as a dependency.

If you want the sql builder without any database specific features, you can install athena_sql directly:

dart pub add athena_sql

Then, import the library in your Dart code:

import 'package:athena_sql/athena_sql.dart';

Usage #

AthenaSQL provides an intuitive and chainable API to build SQL queries for various purposes. Here are some examples to get you started:

SELECT #

final query = await athenaSQL.select(["id", "name", "email"])
  .from("users")
  .where((c) => 
    (c["active"].eq(true))) &&
    ((c["age"] >= 18) ||
    (c["role"] == "admin"))
  .run();

INSERT #

final insertedAmount = await athenaSQL.insert
  .into("users")
  .values({
    "name": "John Doe",
    "email": "john.doe@example.com"
  })
  .run();

UPDATE #

final query = AthenaSQL.update()
  .table("users")
  .set({
    "name": "Jane Doe",
    "email": "jane.doe@example.com",
  })
  .where("id = 1")
  .run();

DELETE #

final query = AthenaSQL.delete()
  .from("users")
  .where("id = 1")
  .run();

CREATE TABLE #

final query = AthenaSQL.createTable("users")
  .column((c) => c.serial("id").primaryKey())
  .column((c) => c.varchar("name", 50).notNull())
  .run();

TODO #

  • update builder
  • delete builder
  • constrains for create table
  • joins
  • subqueries

Documentation #

For more information on using AthenaSQL, check out the official documentation.

Contributing #

We welcome contributions to AthenaSQL! If you're interested in contributing, please read our contributing guide and submit a pull request.

License #

AthenaSQL is released under the BSD 3-Clause License.

1
likes
150
pub points
2%
popularity

Publisher

verified publisherathena-sql.dev

Dart SQL query builder, expressive and user-friendly API to build and manage SQL queries in your Dart projects.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

athena_utils, collection

More

Packages that depend on athena_sql