t

app.wordpace.inkwell.generator

KeyAsIdColumnPlugin

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
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. KeyAsIdColumnPlugin
  2. ColumnPlugin
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def config: GeneratorConfiguration
    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def fromColumn(column: Column): String

    Stringifies the type of the specified column.

    Stringifies the type of the specified column.

    Definition Classes
    KeyAsIdColumnPluginColumnPlugin
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. def id(modelName: String): String
    Attributes
    protected
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from ColumnPlugin

Inherited from AnyRef

Inherited from Any

Ungrouped