laconic 2.2.0
laconic: ^2.2.0 copied to clipboard
A Laravel-style SQL query builder for Dart, supporting MySQL, SQLite, and PostgreSQL.
2.2.0 #
Features #
-
New OR WHERE Methods - Add 11 new OR variant methods to QueryBuilder for Laravel API consistency
orWhereColumn()- OR column comparisonorWhereIn()/orWhereNotIn()- OR IN conditionsorWhereNull()/orWhereNotNull()- OR NULL conditionsorWhereBetween()/orWhereNotBetween()- OR BETWEEN conditionsorWhereBetweenColumns()/orWhereNotBetweenColumns()- OR BETWEEN columnsorWhereAll()/orWhereAny()- OR multi-column conditions
-
New JoinClause BETWEEN Methods - Add 8 new BETWEEN methods to JoinClause
whereBetween()/whereNotBetween()- BETWEEN value conditionsorWhereBetween()/orWhereNotBetween()- OR BETWEEN value conditionswhereBetweenColumns()/whereNotBetweenColumns()- BETWEEN column conditionsorWhereBetweenColumns()/orWhereNotBetweenColumns()- OR BETWEEN column conditions
-
New
orHaving()Method - Add OR HAVING support for GROUP BY queries -
Grammar
compileIncrement()/compileDecrement()- Add abstract methods to SqlGrammar- Enables database-specific placeholder handling (PostgreSQL uses
$N) - QueryBuilder now delegates increment/decrement SQL generation to Grammar
- Enables database-specific placeholder handling (PostgreSQL uses
Bug Fixes #
- Fix PostgreSQL increment/decrement - Previously used
?placeholders directly, now correctly uses Grammar for$Nplaceholders
2.1.0 #
Features #
-
Safety Checks - Add protection against accidental mass operations
delete()now throwsLaconicExceptionwithout WHERE clause by defaultincrement()now throwsLaconicExceptionwithout WHERE clause by defaultdecrement()now throwsLaconicExceptionwithout WHERE clause by default- Use
allowWithoutWhere: trueparameter to explicitly allow operations without WHERE
-
Improved
sole()Method - Now properly validates single record expectation- Throws
LaconicExceptionwhen no records found - Throws
LaconicExceptionwhen multiple records found (previously returned first record)
- Throws
-
Enhanced Exception Handling -
LaconicExceptionnow preserves original error context- Added
causefield to store the original exception - Added
stackTracefield to preserve the original stack trace
- Added
Improvements #
rawSqlDeprecation Warning - MarkrawSqlgetter as deprecated with SQL injection warning- Added
@Deprecatedannotation - Enhanced documentation warning about security risks
- Added
Documentation #
- Update README with
sole()method documentation - Add safety check usage examples
- Fix
operator:→comparator:parameter name in examples
2.0.0 #
Breaking Changes #
-
Driver Abstraction - Refactor from monolithic package to workspace with driver abstraction
- Remove hard dependencies on
mysql_client,sqlite3, andpostgres - Remove
Laconic.mysql(),Laconic.sqlite(),Laconic.postgresql()factory constructors - Remove database-specific code from core package
- Users now pass a
DatabaseDriverinstance toLaconic()constructor
- Remove hard dependencies on
-
Grammar Refactoring - Rename
GrammartoSqlGrammarand move implementations to driver packages- Core package only contains abstract
SqlGrammarclass - Each driver package provides its own grammar implementation:
laconic_sqlite→SqliteGrammarlaconic_mysql→MysqlGrammarlaconic_postgresql→PostgresqlGrammar
- Core package only contains abstract
New Features #
DatabaseDriverInterface - Abstract interface for implementing custom database driversgrammar- Provides SQL dialect-specificSqlGrammarinstanceselect()- Execute SELECT queriesstatement()- Execute non-query statements (INSERT/UPDATE/DELETE/DDL)insertAndGetId()- Execute INSERT and return auto-increment IDtransaction()- Transaction supportclose()- Close database connection
Migration Guide #
Before (1.x):
import 'package:laconic/laconic.dart';
final laconic = Laconic.mysql(MysqlConfig(...));
After (2.0):
import 'package:laconic/laconic.dart';
import 'package:laconic_mysql/laconic_mysql.dart';
final laconic = Laconic(MysqlDriver(MysqlConfig(...)));
Package Structure #
The project is now a Dart workspace with separate driver packages:
laconic- Core package with query builder and abstract interfaceslaconic_sqlite- SQLite driverlaconic_mysql- MySQL driverlaconic_postgresql- PostgreSQL driver
1.0.3 #
Performance #
- Fix
count()performance issue - Use SQLCOUNT(*)aggregate function instead of fetching all rows- Before:
SELECT * FROM tablethen count rows in Dart (results.length) - After:
SELECT COUNT(*) as aggregate FROM table - Impact: O(n) → O(1) for network transfer and memory usage
- Before:
1.0.2 #
Features #
- Complete JOIN Support - Add all common JOIN types aligned with Laravel
leftJoin()- LEFT JOIN queriesrightJoin()- RIGHT JOIN queriescrossJoin()- CROSS JOIN queries (cartesian product)
- Enhanced JoinClause - Add 12 new condition methods for complex JOIN queries
- Column conditions:
whereColumn(),orWhereColumn() - NULL conditions:
whereNull(),orWhereNull(),whereNotNull(),orWhereNotNull() - IN conditions:
whereIn(),orWhereIn(),whereNotIn(),orWhereNotIn()
- Column conditions:
Testing #
- Refactor test files for better organization
test/test_helper.dart- Shared configuration, schema definitions, and test datatest/sqlite_test.dart- SQLite-specific teststest/mysql_test.dart- MySQL-specific teststest/postgresql_test.dart- PostgreSQL-specific tests
- Unified test data across all three databases
- Total test count: 204 tests (all passing)
Documentation #
- README restructure - English is now the default, Chinese available as optional link
README.md- English documentation (default)README_ZH.md- Chinese documentation
- Update COMPARISON_REPORT.md with complete JOIN coverage analysis
- Update CLAUDE.md with new architecture details and test structure
- Add comprehensive JOIN examples in documentation
Statistics #
- Total methods: 57
- Laravel coverage: ~75%
- JOIN coverage: 82%
- Test coverage: 204 test cases across 3 databases
1.0.1 #
Features #
- PostgreSQL Support - Add full PostgreSQL database support
- New
Laconic.postgresql(config)constructor - PostgreSQL-specific parameter binding (
$1, $2, $3...) RETURNING idclause forinsertGetId()- Connection pooling with up to 10 concurrent connections
- SSL connection support
- New
Architecture #
- Add
PostgresqlGrammarclass for PostgreSQL-specific SQL generation - Add
compileInsertGetId()method to Grammar interface- Separates INSERT and INSERT RETURNING logic
- PostgreSQL uses
RETURNING idclause - MySQL/SQLite use
lastInsertIdmechanism
- Add
PostgresqlConfigfor PostgreSQL connection configuration
Testing #
- Add comprehensive PostgreSQL test suite (64 tests)
- Unify test data structure across SQLite, MySQL, and PostgreSQL
- All 187 tests passing across three databases
1.0.0+36 #
Features #
- Add advanced query methods:
whereAll(),whereAny(),whereNone() - Add column comparison methods:
whereBetweenColumns(),whereColumn() - Enhanced JOIN support:
orOn(),where(),orWhere()conditions - Add batch insert functionality, support inserting lists of data
- Add transaction support for MySQL and SQLite
- Add query listener for SQL debugging and logging
- Add
addSelect()method for appending select fields - Add
when()conditional method
Breaking Changes #
- Refactor AST-based query builder to Grammar pattern
- Simplified code structure for better maintainability
- More flexible SQL generation mechanism
- Easier to extend support for new databases
Documentation #
- Add Chinese documentation and improve English README
- Add comprehensive comparison report between Laconic and Laravel Query Builder
- Update CLAUDE.md with architecture details and development guide
- Enhanced example code with comprehensive usage demonstrations
- Add Flutter dependency requirement note
Improvements #
- Unify API naming: rename
mysqlLaconicandsqliteLaconictolaconic - Improve constructors to accept config parameters directly
- Optimize connection management with proper close calls
0.0.1 #
- Initial version.