laconic 3.0.0
laconic: ^3.0.0 copied to clipboard
A Laravel-style SQL query builder for Dart, supporting MySQL, SQLite, and PostgreSQL.
3.0.0 #
Breaking Changes #
- Affected row counts —
QueryBuilder.update(),delete(),increment(), anddecrement()now returnFuture<int>with the affected row count instead ofFuture<void> - Custom driver API —
DatabaseDriverimplementations must now implementaffectingStatement(String sql, [List<Object?> params])and return the affected row count reported by the database
Features #
- Added
Laconic.affectingStatement()to execute UPDATE/DELETE statements, notify the query listener, and return the affected row count
2.3.1 #
Bug Fixes #
clone()nested WHERE —clone()now recursively deep-copies nested WHERE conditions (type: 'nested'), preventing original and cloned builders from sharing nested condition listsdump()double compilation —toSql(),getBindings(), anddump()now share a single compilation via_compileForDebug(), eliminating redundant grammar passes
2.3.0 #
Features #
New QueryBuilder Methods (Laravel API Alignment)
- WHERE Sugar:
whereNot(),orWhereNot(),whereLike(),orWhereLike(),whereNotLike(),orWhereNotLike() - Ordering Sugar:
orderByDesc(),latest(),oldest(),inRandomOrder(),reorder() - Limit/Offset Sugar:
skip(),take(),forPage() - Conditional:
unless()(inverse ofwhen()) - Retrieval Shortcuts:
find(id),firstWhere(column, value) - Nested WHERE:
whereNested(callback),orWhereNested(callback)— parenthesized sub-condition groups - WHERE EXISTS:
whereExists(callback),orWhereExists(callback),whereNotExists(callback),orWhereNotExists(callback)— subquery EXISTS clauses - Date WHERE:
whereDate(col, val),whereTime(col, val),whereDay(col, val),whereMonth(col, val),whereYear(col, val)withorvariants - DDL:
truncate()— truncates the table (resets auto-increment) - Insert Variants:
insertOrIgnore(data)— INSERT OR IGNORE;upsert(data, uniqueBy: [...], update: [...])— INSERT ON CONFLICT / ON DUPLICATE KEY UPDATE - Row Locks:
lockForUpdate()(FOR UPDATE),sharedLock()(FOR SHARE / LOCK IN SHARE MODE) - UNION:
union(callback),unionAll(callback)— UNION / UNION ALL subqueries - Table Alias:
from(table)— change query table (for subqueries) - Debug:
toSql(),getBindings(),dump(),dd()— inspect SQL without executing - Chunking:
chunk(count, callback),chunkById(count, callback),each(callback)— process large result sets in batches - Clone:
clone()— deep copy builder for reusable query scopes
New JoinClause Methods
whereLike(),orWhereLike(),whereNotLike(),orWhereNotLike()— LIKE sugar in JOINswhereExists(),orWhereExists(),whereNotExists(),orWhereNotExists()— EXISTS subqueries in JOINs
New Grammar Methods
compileTruncate()— truncate table (abstract, implemented per driver)compileInsertOrIgnore()— INSERT OR IGNORE (abstract, implemented per driver)compileUpsert()— UPSERT (abstract, implemented per driver)compileSelect()now accepts optionallocksparameter for FOR UPDATE / FOR SHARE
Performance #
- Empty
whereInShort-Circuit: whenwhereIn('col', [])guarantees zero results, the query builder skips the database round-trip entirely and returns empty results immediately count()with GROUP BY: now uses a subquery (SELECT COUNT(*) FROM (SELECT 1 ... GROUP BY ...)) to count groups server-side, instead of fetching all rows_aggregate()Preserves Clauses:avg(),sum(),max(),min()now correctly preserve_groups,_havings, and_distinct
Bug Fixes #
update({})Validation: now throwsLaconicExceptionfor empty data maps instead of generating invalid SQL
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 #
- New
Expressionandraw()- Embed raw SQL expressions in queries without parameterization - New
orderByRaw()- Add raw ORDER BY expressions with optional bindings - New
groupByRaw()- Add raw GROUP BY expressions - New
havingRaw()/orHavingRaw()- Add raw HAVING conditions with optional bindings - New
selectRaw()- Add raw SELECT expressions - New
whereRaw()/orWhereRaw()- Add raw WHERE conditions with optional bindings - New
when()- Conditionally apply query constraints - New
distinct()- Select distinct records - New
orWhereColumn()- OR column comparison
Bug Fixes #
sole()now fetches exactly 2 rows to distinguish "no results" from "multiple results"insert()now validates that data is non-empty
2.0.0 #
Breaking Changes #
- Query execution methods are now async -
get(),first(),insert(),update(),delete(), etc. all returnFuture DatabaseDriverinterface - All driver methods now returnFutureSqlGrammarabstract class - Grammar methods now returnCompiledQuerysynchronously
Features #
- PostgreSQL Support - New
laconic_postgresqldriver package with$Npositional parameter support and RETURNING clause - MySQL Support - New
laconic_mysqldriver package with prepared statements and connection pooling - SQLite Support - New
laconic_sqlitedriver package usingsqlite3native library - Fluent Query Builder - 57+ methods covering ~75% of Laravel Query Builder API
- Parameterized Queries - Automatic SQL injection prevention via parameter binding
- Transaction Support -
laconic.transaction()with automatic commit/rollback - JoinClause - Complex JOIN conditions with ON, WHERE, and nested conditions
- Query Listener -
laconic.listencallback for query logging
1.0.0 #
Initial release.