c

app.wordpace.inkwell.generator

KeyAsIdProperty

abstract class KeyAsIdProperty extends DefaultProperty

This property class resolves primary and foreign key columns to the correct type reference:

(1) A single-column primary key of a type A is resolved to a type id(A), where id is an overridable type reference constructor with no default. For example, for a table person with a primary key column id, a property id: Id[Person] would be emitted if the id(A) type was Id[A]. (2) A foreign key pointing to a single-column primary or unique key (see Column.references) is resolved to the data type of the referenced property. For example, for a table employees with a foreign key column person_id, a property personId: Id[Person] would be emitted, using the type Id[Person] of the referenced property.

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: For Quill support, your id type should either extend AnyVal (which should suffice in most use cases) or come with an encoder and decoder.

In any case, this property only handles single-column primary and foreign keys. You will have to implement some individual handling if you want to type multi-column keys.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. KeyAsIdProperty
  2. DefaultProperty
  3. Serializable
  4. Serializable
  5. Product
  6. Equals
  7. Property
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new KeyAsIdProperty(column: Column, model: Model, config: GeneratorConfiguration)

Abstract Value Members

  1. abstract def id(modelType: TypeReference): TypeReference

    Wraps the given model type reference in your Id type.

    Wraps the given model type reference in your Id type.

    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. val column: Column

    The column to be transformed.

    The column to be transformed.

    Definition Classes
    KeyAsIdPropertyDefaultPropertyProperty
  7. val config: GeneratorConfiguration
    Definition Classes
    KeyAsIdPropertyDefaultProperty
  8. def dataType: TypeReference

    The data type of the property.

    The data type of the property. Even though Column already provides a type reference, you can override this definition to provide an updated type based on the property without overriding tpe.

    Definition Classes
    KeyAsIdPropertyProperty
  9. def defaultValue: Option[String]

    The default value of the property.

    The default value of the property.

    By default, only nullables are translated to a Scala default value. If you need to translate other default values, please override this method.

    Definition Classes
    DefaultPropertyProperty
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. val model: Model

    The model that owns the property.

    The model that owns the property.

    Definition Classes
    KeyAsIdPropertyDefaultPropertyProperty
  14. def name: String

    The name of the property.

    The name of the property.

    Definition Classes
    DefaultPropertyProperty
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def tpe: TypeReference

    The scala type of the property.

    The scala type of the property. Sometimes, this type may be a wrapped version of dataType, such as the data type wrapped in an Option for nullable columns.

    Definition Classes
    DefaultPropertyProperty
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  22. 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 DefaultProperty

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Property

Inherited from AnyRef

Inherited from Any

Ungrouped