TableDef

io.eezo.db.TableDef
final case class TableDef(name: String, columns: List[ColumnDef])

A table's columns, for the statements that address rows rather than shape.

Attributes

Source
ColumnDef.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def countWhere(where: String): String

Attributes

Source
ColumnDef.scala
def deleteAll: String

Attributes

Source
ColumnDef.scala
def deleteById: String

Attributes

Source
ColumnDef.scala
def deleteByIdOwnedBy(owner: ColumnDef): String

Attributes

Source
ColumnDef.scala
def deleteWhere(where: String): String

Attributes

Source
ColumnDef.scala

The primary key column. The Table macro refuses a model without an id, so this is total in practice; the throw is for a TableDef assembled by hand.

The primary key column. The Table macro refuses a model without an id, so this is total in practice; the throw is for a TableDef assembled by hand.

Attributes

Source
ColumnDef.scala
def insert: String

Attributes

Source
ColumnDef.scala
def quoted: String

Attributes

Source
ColumnDef.scala
def selectAll: String

Attributes

Source
ColumnDef.scala
def selectAllOrderedById: String

Every row in primary-key order, which is what core's Store[A] promises all() returns. Not selectAll's job: a query with no order by is what db's own API hands the query DSL, and the DSL's caller says its own order.

Every row in primary-key order, which is what core's Store[A] promises all() returns. Not selectAll's job: a query with no order by is what db's own API hands the query DSL, and the DSL's caller says its own order.

Attributes

Source
ColumnDef.scala

The four statements above, narrowed to the rows one owner has.

The four statements above, narrowed to the rows one owner has.

They are rendered here rather than assembled where they are used, for the reason every other statement on this type is: a where composed at the call site is the one that is written four times and forgotten on the fourth, and a narrowed delete that forgot its owner deletes somebody else's row. Reading these five lines is how that is checked.

The owner arrives as the ColumnDef the caller already resolved rather than as a name, because a name would have to be quoted here and looked up somewhere else, and the lookup is what turns a wrong owner field into a failure at boot instead of a wrong query at runtime.

The owner comes after the key in the three keyed statements, so a caller binds the key where it always bound it and the owner last. For the update that means after every column the set clause writes, the key, and then the owner.

Attributes

Source
ColumnDef.scala
def selectById: String

Attributes

Source
ColumnDef.scala
def selectByIdOwnedBy(owner: ColumnDef): String

Attributes

Source
ColumnDef.scala
def selectWhere(where: String): String

Built on selectAll, deliberately: the column list is rendered in exactly one place, so the select list and decode's offsets cannot drift apart (BACKLOG §4, DESIGN §9.4).

Built on selectAll, deliberately: the column list is rendered in exactly one place, so the select list and decode's offsets cannot drift apart (BACKLOG §4, DESIGN §9.4).

Attributes

Source
ColumnDef.scala
def updateById: String

Sets every column, including the key, and binds them in declaration order.

Sets every column, including the key, and binds them in declaration order.

Setting the key to the value it already has is a no-op, and it buys the one thing that matters: encode can be reused exactly as it is. A set clause that skipped the key would need its own column ordering, and that is a second ordering decision to keep in step with decode — the same trap DESIGN §9.4 avoids for the select list. The key is bound once more at the end, for the where.

Attributes

Source
ColumnDef.scala
def updateByIdOwnedBy(owner: ColumnDef): String

Attributes

Source
ColumnDef.scala

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala