JsonTable extension type

A table of JsonRows whose shape each case chooses.

Why an extension type: it is exactly a DbTable<JsonRow> (so the database keeps it as one), with a constructor that names the shape.

on
Implemented types

Constructors

JsonTable(String name, {String key = 'id', bool autoIncrementKey = false, List<List<String>> indexes = const [], List<List<String>> uniqueIndexes = const [], String? syncWith})
A table name keyed by key, with indexes over the named fields and uniqueIndexes (each index is named after its fields), synchronized with the remote syncWith when given.

Properties

autoIncrement → bool
Rows inserted without a primary key get the next integer.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
indexes → List<Index>
Secondary indexes, maintained in the same transaction as the rows.
finalinherited
primaryKey → Field<Object>
The field that identifies a row.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schema → TableSchema
The definition sent to the engine.
no setterinherited
syncWith → String?
The remote this table synchronizes with, or null for a local table.
finalinherited
tableName → String
Name of the table.
finalinherited

Methods

all() → SelectQuery<JsonRow>
Every row (SELECT * FROM table).
inherited
belongingTo<V extends Object>(Iterable<V> parentKeys, Field<V> foreignKey) → SelectQuery<JsonRow>
The rows whose foreignKey is one of parentKeys: the children of some parents, in one query (Diesel's belonging_to). Group them with Associations.groupedBy.
inherited
delete() → DeleteQuery<JsonRow>
Deletes rows (delete(table).filter(...)).
inherited
field<V extends Object>(String name, {Object? encode(V value)?, V? decode(Object stored)?}) → Field<V>
The field at name of the rows, compared and read as values of V (see Field for how values are encoded, and encode / decode for a model that stores a value another way).
inherited
filter(Expression condition) → SelectQuery<JsonRow>
Rows matching condition.
inherited
find(Object key) → FindQuery<JsonRow>
The row whose primary key is key.
inherited
groupBy(List<Field<Object>> keys) → GroupQuery<JsonRow>
Every row grouped by keys (GROUP BY).
inherited
innerJoin(DbTable<Object?> table, {required Field<Object> on, required Field<Object> equals}) → JoinQuery
This table joined with table where the equals field of table equals the on field of this one (INNER JOIN).
inherited
insert(Iterable<JsonRow> rows) → InsertQuery<JsonRow>
Inserts rows (insert_into(table).values(rows)).
inherited
leftJoin(DbTable<Object?> table, {required Field<Object> on, required Field<Object> equals}) → JoinQuery
Like innerJoin, keeping the rows of this table without a match (LEFT JOIN).
inherited
mapRow(Map<String, Object?> json) → Result<JsonRow, DbError>
The row of a stored json, or DbErrorCode.rowMapping when the model cannot read it: a stored row that does not fit the model is data to report, not a crash.
inherited
mapRows(List<Map<String, Object?>> json) → Result<List<JsonRow>, DbError>
The rows of json, or the error of the first one that does not fit.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
order(OrderingTerm term) → SelectQuery<JsonRow>
Every row, sorted by term.
inherited
toString() → String
A string representation of this object.
inherited
update() → UpdateQuery<JsonRow>
Updates rows (update(table).filter(...).set(...)).
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

rows(Iterable<Map<String, Object?>> json) → List<JsonRow>
Rows from plain maps.