basalt 0.1.0
basalt: ^0.1.0 copied to clipboard
A type-safe, migration-first ORM for Dart: a compile-time-checked query builder, code-generated row mappers, and pluggable SQL backends.
Changelog #
0.1.0 #
Schema model redesign: table markers are real objects, columns are typed to their table.
- Breaking: a table marker is now a
final class X extends TableRef<X>with a private const constructor;static const table = X._()is the singleton instance. Columns take that object as their first argument (PrimaryKey<int, Users>(table, 'id', IntSqlType())) instead of repeating the table-name string — handing a column another table's ref is a compile error. - Breaking:
TableRefis abstract and stores onlytableName; the marker overridescolumnsas a getter (lazy evaluation is what keepstable⇄ columns free of const-initializer cycles, FKs included). - Breaking:
QuerySource.tablerenamed totableName, andTableRef.namemerged into it — a static column named like an inherited instance member would not compile, sotable/namehad to leave the instance surface.TableColumn.table(the effective SQL qualifier string) is unchanged and now derived asowner.alias ?? owner.tableName. TableColumngainedowner(QuerySource<Tbl>);TableAliasrebinds columns by passing itself as the owner.- Serialization, scope validation, and
RowReaderkeys are byte-for-byte unchanged — only the schema declaration surface moved.
0.0.3 #
Shared DevTools inspector client — one host + client + DTO layer behind the
ext.basalt.* protocol, so the DevTools extension and the basalt_mcp server
stop re-implementing it.
- New
package:basalt/devtools_client.dartentrypoint (kept separate from the hostpackage:basalt/devtools.dart): a transport-agnosticInspectorClientplus anInspectorTransportseam and the shared DTOs. Consumers implement only the transport (VM service, DevToolsserviceManager, ...). BasaltExtension— enum of theext.basalt.*method names, the single source of truth for host registration and every client (exported from both entrypoints).- DTO
fromJsonfactories now parse realjsonDecodeoutput (previously the blindas List<...>casts threw);SqlResultDto.fromJsonrestorestruncated;RegisteredInstance.fromJsonadded. - Breaking (dev-only):
RegisteredInstance.backendremoved — the inspector no longer infers a backend name.InspectorServicenow takes placeholders, identifier quoting, and value encoding fromConnection.dialect(this also fixesDateTimeencoding on the raw-SQL path).lib/src/devtools/was reorganized intoprotocol/·dto/·host/·client/(internal), andInspectorServicewas split into focused collaborators.
0.0.2 #
Single-statement batch writes.
updateAll(table).keyedBy(col).values([...])— a newUpdateAllStatementthat updates many rows with per-row values in one statement (WITH ... AS (VALUES ...) UPDATE ... FROM), with composite keys (repeatedkeyedBy), an optional extra.where(...), andRETURNINGsupport (columns are table-qualified there to stay unambiguous next to theVALUEStable).SqlDialect.castType(SqlType)— new dialect seam naming the native type toCASTa bound parameter to where SQL gives the server no inference context (theVALUEStable ofupdateAll); dialects that don't need casts returnnull.ColumnValuenow carries the column'sSqlType(set byTableColumn.set) so serialization can emit those casts.- A zero-row
INSERT(no.value(...)/.values(...)) now throwsStateErrorat build time instead of emitting invalid SQL. @Insertabledoc updated for the new generated batch extension (seebasalt_codegen0.0.2).
0.0.1 #
Initial development release of the basalt_dart core.
- Type system:
SqlType<T>codecs (IntSqlType/StringSqlType/DoubleSqlType/BooleanSqlType/BlobSqlType/DateTimeSqlType) with a singleNullableSqlType(...)wrapper for nullable columns. - Schema: sealed
TableColumn<T, Tbl>(ValueColumn/PrimaryKey/Ref),TableRef,QuerySource,TableAliasfor self-joins. - Expressions with phantom table scope;
eq/ne/gt/ge/lt/le/isIn/between/isNull/like/eqColumn, operator sugar, and&/|combinators. - Query builder:
from().where().orderBy().limit().offset().select().innerJoin()/leftJoin().map()→MappedQuery;RowReader(read by column name) and reusableRowMapper. - Writes:
insertInto/update/deleteFromwithTableColumn.set. - Serializer (
QueryBuilder+SqlDialect) with two-tier join scope validation. - Async-first
Connectioninterface with transactions (nested → SAVEPOINT) andintrospect(). - Annotations for codegen:
@Queryable,@Insertable,@AsChangeset,@Column(readOnly/writeOnly),@Relation.