laconic 5.0.1
laconic: ^5.0.1 copied to clipboard
A Laravel-style SQL query builder for Dart, supporting MySQL, SQLite, and PostgreSQL.
5.0.1 #
- Republish with a plain semantic version without build metadata.
- Update README installation examples for the coordinated patch release.
- No runtime behavior changes.
5.0.0 #
Breaking changes and migration #
- Add
SqlGrammar.compileUnion. Custom grammars usingextends SqlGrammarinherit the default implementation; classes usingimplements SqlGrammarmust implement the new method. chunkByIdnow replaces existing ordering with ascending cursor order and applies an initial offset only to the first batch. The cursor must be unique, non-null and included in the result. Chunk sizes must be positive.- Ordering, limit and offset on the parent builder apply to the complete UNION; clauses inside a UNION callback apply to that branch.
- Use this release with
laconic_sqlite: ^3.0.0,laconic_mysql: ^4.0.0orlaconic_postgresql: ^3.0.0.
Fixes #
- Preserve valid OR branches when
whereInis empty, including nested conditions and all retrieval methods. - Group existing OR filters before adding a chunk cursor; apply the cursor to the entire UNION. Capture the cursor and batch size before invoking callbacks that may modify the returned list.
- Compile complete UNION branches for retrieval, aggregates and SQL inspection, retaining projections, bindings and branch pagination.
- Preserve grouping and HAVING in existence checks and EXISTS subqueries; count grouped, distinct and UNION results correctly.
Performance #
- Add
LaconicResult.fromRowsto share column metadata and indexes across driver rows without intermediate maps. Duplicate names retain their first position and last value. - Keep mutable
columnsandvaluescompatible. Requesting a row's mutablecolumnslist switches that row to linear lookup so external changes remain visible. - Limit grouped scalar aggregates to the first result, matching their return contract.
4.1.0 #
Features #
LaconicExceptionnow carries structureddriverandcodefields (both optional) so consumers can react to driver-specific error codes without parsing the message.driveris the backend identifier (mysql,postgres,sqlite);codeis the raw driver error code as a string (MySQL server error code, PostgreSQL SQLSTATE, SQLite extended result code). Values are opaque to the core and never comparable across drivers. Existing single-argument constructions are unaffected.
4.0.0 #
Breaking Changes #
LaconicExceptionsimplified — removed thecauseandstackTracefields. Driver errors are now embedded in the message viatoString(), so exception output no longer repeats the same message asCaused by: .... Drivers also rethrow an existingLaconicExceptioninstead of wrapping it again, eliminating nestedLaconicException: LaconicException: ...messages.
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.