Types
@system-inc/base-foundation · 515c140 · 49 symbols
DrizzleSchema
DrizzleTableLike
Structural shape of a Drizzle table used by adapter internals. Drizzle's
dialect-specific table types (SQLiteTable, MySqlTable, PgTable) are
heavily inferred from schema definitions — accepting one of them as a
parameter forces the caller through that inference. This shape captures
just the dynamic-column-lookup behavior the shared helpers actually need.
Helper type to extract the value type from a filter
MySqlDb
MySqlTx
OrmAdapterType
A single write operation that can be included in a writeBatch. The
batch as a whole is atomic — either all operations commit or none do.
The upsert kind uses ON CONFLICT/ON DUPLICATE KEY semantics so the
conflict target comes from the entity's primary key columns, not from
arbitrary where conditions. Use OrmAdapter.upsert() outside a batch
if you need the read-then-write variant with complex conditions.
The execute kind runs a raw write statement (built with the drizzle
sql template) inside the same atomic batch — the escape hatch for
bulk updates the entity API can't express (computed SET clauses,
conditional shifts, increments over arbitrary conditions). No entity
lifecycle hooks run for it.
OrmColumnOptions
Members
comment?:stringdefault?:DefaultValueType<T> | () => DefaultValueType<T>name?:stringnullable?:booleanprimaryKey?:booleantransformer?:OrmValueTransformerunique?:boolean
OrmColumnType
OrmCredentials
SQL dialect spoken by the database. Determines syntax-level behavior
(e.g. ON CONFLICT vs ON DUPLICATE KEY UPDATE, RETURNING vs
lastInsertId). Adapters branch on this.
OrmDatabaseType
Identifies a database backend as a (dialect, driver) pair. Dialect is the SQL syntax; driver is the specific client library / deployment surface used to reach it. Providers branch on the pair to know which connection setup applies.
Extract the database-type entries that match the given dialect. Useful
for typing adapter generics that work across all drivers of one dialect
(e.g. the SQLite abstract base accepts all sqlite drivers).
OrmDateEventMap
OrmDateEventType
OrmDeleteResult
OrmEntityClass
The constructor type for an ORM entity class.
Every entity extends OrmTrackingEntity (directly or via
OrmBaseEntity / OrmMutableBaseEntity), which installs the per-column
change-tracking accessors the repository and hydrator rely on. Registration
and data-access APIs are typed against this so a class that forgets to extend
the base is rejected where it is registered, not at first use.
OrmEntityKey
OrmEntityKeys
OrmFilter
Union type of all filter operators The discriminated union allows TypeScript to narrow types based on the 'type' field
Options for loading relations. Can be a boolean to load the relation, or nested options for loading nested relations.
OrmIndexColumn
A column reference in an index declaration: a bare property name, or a name paired with a prefix length.
The bare-string form is the overwhelming majority and stays untouched, so adding prefix support changed no existing declaration.
OrmInsertResult
Members
affectedRows?:numberRows the statement addressed. DIALECT CAVEAT for UPDATE: SQLite counts MATCHED rows, but MySQL (without CLIENT_FOUND_ROWS, which the PlanetScale HTTP driver cannot enable) counts CHANGED rows — an update that matches a row but leaves every value identical reports 0 there. Do not use
affectedRows === 0as an existence check on updates in portable code; query the row instead. Upsert counts are normalized (1 per operation on every dialect); deletes count matched rows everywhere.raw?:unknownreturning?:TReturning[]
OrmPartialEntity
OrmRawData
Type helper that represents the raw data form of an entity. Strips out methods, tracking fields, and other non-data properties, leaving only the plain data that would be stored in the database.
This type is used by OrmDatabase methods to accurately represent that they return plain JavaScript objects from the database, not entity instances with methods and tracking capabilities.
OrmSettings
OrmTextSizeType
Members
condition:OrmFindOptionsWhere<EntityType> | (OrmFindOptionsWhere<EntityType>)[] | OrmPartialEntity<EntityType> | (OrmPartialEntity<EntityType>)[]A Drizzle SQL condition that defines the filter. Example: eq(events.status, 'ok')
key:stringA stable key for this count, e.g. 'status:ok' or 'tool:Ping'.
Members
distinctColumn?:stringendAtUtc:numberfilters?:(OrmTimeSeriesFilter<EntityType>)[]interval:TimeIntervallimit?:numberoffset?:numberstartAtUtc:numbertimeColIsEpochSec?:booleantimeZone?:stringwhere?:OrmFindOptionsWhere<EntityType> | (OrmFindOptionsWhere<EntityType>)[] | OrmPartialEntity<EntityType> | (OrmPartialEntity<EntityType>)[]
Type definition for transaction callbacks
OrmUpdateResult
RelationKey
Used to type inverseSide so it must name a real relation on the target
entity — compile-checked, autocompleted, and updated by IDE rename-symbol
rather than an unchecked string. If no relation keys can be identified for
the target (e.g. it doesn't type its relations as entities), this falls back
to string so the option stays usable instead of becoming never.