trait KeyAsIdColumnPlugin extends ColumnPlugin
This type emitter plugin resolves primary and foreign key columns to the correct raw type:
(1) A single-column primary key of a type A is resolved to a type id(A), where id is an overridable
function which defaults to Id[A]. For example, for a table person with a primary key column id,
a property id: Id[Person] is emitted.
(2) A foreign key pointing to a single-column primary or unique key (see Column.references) is resolved
to the raw type of the referenced column (as specified by its PropertyEmitter). For example, for a
table employees with a foreign key column person_id, a property personId: Id[Person] is emitted,
using the type Id[Person] of the referenced column.
For a primary key that is also a foreign key, case (2) prevails, since the primary key is then interpreted as the primary key of another table, just replicated here due to a one-to-one relationship. (This is valid in a few edge cases where the original table can't or shouldn't be manipulated to add more columns.)
Usage Note: The default implementation of id(A) requires you to import any type Id[A] (via
GeneratorConfiguration.imports). For Quill support, it must either extend AnyVal (which should suffice
in most use cases) or come with an encoder and decoder.
In any case, this emitter only handles single-column primary and foreign keys. You will have to implement some individual handling if you want to type multi-column keys.
- Self Type
- KeyAsIdColumnPlugin with TypeEmitter
- Alphabetic
- By Inheritance
- KeyAsIdColumnPlugin
- ColumnPlugin
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
config: GeneratorConfiguration
- Attributes
- protected
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fromColumn(column: Column): String
Stringifies the type of the specified column.
Stringifies the type of the specified column.
- Definition Classes
- KeyAsIdColumnPlugin → ColumnPlugin
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
id(modelName: String): String
- Attributes
- protected
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )