Scoped

io.eezo.http.Scoped
See theScoped companion object
final class Scoped[A] extends Store[A]

The store an owned model's routes are mounted over: the whole table, and the narrowing of it.

A Store[A] itself, so that Resource.routes keeps the one store parameter it has always had and the generated route table keeps the row it has always emitted. An owned model's routes are mounted by the same line as every other model's; the difference travels inside the value.

The owner's type is gone from the signature on purpose, and this is the one place in eezo where it is. It is Id[U] for every caller, U is known only where the model's own declaration is written, and nothing between that declaration and here needs to know it: the value that reaches by is the one Owned.currentUser read out of the request, and the function that consumes it is the one Scoped.apply closed over the matching io.eezo.core.OwnedStore. The two are built from the same declaration, so the cast inside apply cannot see a value of another type.

Public only because the generated route table has to name it, the same way InMemoryStore is. No user writes one.

Attributes

Companion
object
Source
Scoped.scala
Graph
Supertypes
trait Store[A]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def all(): Seq[A]

Every row, ordered by primary key.

Every row, ordered by primary key.

The order is part of the contract rather than an implementation's habit, because a derived index renders it and a page that reshuffles itself on every write is a page nobody can read. Primary key rather than insertion, because insertion order is the one order a JDBC implementation cannot reproduce without a column invented to hold it, and a promise only one side can keep is not a seam.

Attributes

Source
Scoped.scala
def by(owner: Any): Store[A]

This owner's rows, as a store of their own.

This owner's rows, as a store of their own.

Attributes

Source
Scoped.scala
def delete(key: Id[A]): Boolean

Removes the row under key. false when there was none, which is the derived destroy's 404.

Removes the row under key. false when there was none, which is the derived destroy's 404.

Attributes

Source
Scoped.scala
def find(key: Id[A]): Option[A]

The row under key, or nothing.

The row under key, or nothing.

Attributes

Source
Scoped.scala
def insert(key: Id[A], row: A): Unit

Adds a row.

Adds a row.

Unit, not an outcome: every key a derived create inserts is an Id.gen() minted milliseconds earlier, so a taken key is unreachable and a conflict result would be a branch that can never be taken.

Attributes

Source
Scoped.scala
def update(key: Id[A], row: A): Boolean

Replaces the row under key. false when there is none, which is what a derived update turns into a 404 without reading the row back first.

Replaces the row under key. false when there is none, which is what a derived update turns into a 404 without reading the row back first.

Attributes

Source
Scoped.scala