Resource

io.eezo.http.Resource
See theResource companion trait
object Resource

Attributes

Companion
trait
Source
Resource.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Resource.type

Members list

Value members

Concrete methods

def apply[A](using r: Resource[A]): Resource[A]

Attributes

Source
Resource.scala
inline def derived[A](using m: ProductOf[A], form: Form[A], actions: Actions[A]): Resource[A]

Attributes

Source
Resource.scala
inline def routesOf[A](store: Store[A], guarded: Guarded[A] = ...): Seq[Route]

The routes of A if it has a Resource, and nothing if it does not.

The routes of A if it has a Resource, and nothing if it does not.

This is what the sbt plugin emits, one line per candidate case class, so that the compiler decides which models mount rather than a text scan guessing from a derives clause. It sees through a type alias and finds a hand-written given Resource[A], neither of which a regex can, and a model with no instance yields Nil instead of failing to compile.

What the declaration carries comes out in front of the model's own routes, so that guarding a model is also what mounts the page its refusals redirect to. Guarded.public carries nothing, which is why an application with no guard emits exactly the table it always did. A guard hands the same route instances to every declaration it makes, so a table with two guarded models holds the login page twice and distinct takes one; the generator emits that distinct, because RouteTable refuses the same method and path twice rather than picking a winner.

Attributes

Source
Resource.scala