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.
- 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
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';
AthenaSQL provides an intuitive and chainable API to build SQL queries for various purposes. Here are some examples to get you started:
final query = await athenaSQL.select(["id", "name", "email"])
.from("users")
.where((c) =>
(c["active"].eq(true))) &&
((c["age"] >= 18) ||
(c["role"] == "admin"))
.run();
final insertedAmount = await athenaSQL.insert
.into("users")
.values({
"name": "John Doe",
"email": "[email protected]"
})
.run();
final query = AthenaSQL.update()
.table("users")
.set({
"name": "Jane Doe",
"email": "[email protected]",
})
.where("id = 1")
.run();
final query = AthenaSQL.delete()
.from("users")
.where("id = 1")
.run();
final query = AthenaSQL.createTable("users")
.column((c) => c.serial("id").primaryKey())
.column((c) => c.varchar("name", 50).notNull())
.run();
- update builder
- delete builder
- constrains for create table
- joins
- subqueries
For more information on using AthenaSQL, check out the official documentation.
We welcome contributions to AthenaSQL! If you're interested in contributing, please read our contributing guide and submit a pull request.
AthenaSQL is released under the BSD 3-Clause License.