package generator

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. trait CamelCaseToSnakeCase extends NamingStrategy

    This strategy will make your Scala names adhere to snake_case! In 95% of cases, you probably want to use SnakeCaseToCamelCase instead.

    This strategy will make your Scala names adhere to snake_case! In 95% of cases, you probably want to use SnakeCaseToCamelCase instead. (That is, NamingStrategies are "reversed" in terms of intended usage compared to Quill.)

    Example (sql name => scala name): someIdent => some_ident

  2. trait CompanionEmitter extends AnyRef

    Handles the transformation of one table to a model's companion object.

  3. class DefaultCompanionEmitter extends CompanionEmitter
  4. class DefaultModelEmitter extends ModelEmitter

    Generates a simple case class based on the configured naming strategy, selected property emitter and inheritance configurations.

  5. class DefaultPropertyEmitter extends PropertyEmitter

    Emits a property based on the globally configured naming strategy and without locally modifying the raw type.

  6. abstract class DefaultSchemaEmitter extends SchemaEmitter
  7. class DefaultTypeEmitter extends TypeEmitter
  8. sealed trait Import extends AnyRef
  9. class ImportSimplifyingTypeEmitter extends DefaultTypeEmitter

    Simplifies the names of all imported types and packages.

    Simplifies the names of all imported types and packages.

    Simplifies "java.lang._", "scala._" and "scala.Predef._" by default, since Scala imports these namespaces by default.

  10. case class Inheritances(map: Map[String, Seq[TypeReference]]) extends Product with Serializable

    Inheritances holds all inheritance declarations (extends, with) for the whole schema.

    Inheritances holds all inheritance declarations (extends, with) for the whole schema. Please take care to only provide one proper class to extend (although failing to adhere to this will only result in generated code that does not compile).

    Note that the inheritance map should use Scala names. Although Scala names depend on the NamingStrategy, Scala names are closer to the actual "A extends B" declaration and thus easier to use in the context of inheritance. Additionally, SQL names are usually case insensitive, which would complicate using SQL names.

    Inheritance declarations are based on TypeReference instances. NamedTypeReference can be used for types which don't have a valid representation at generator runtime. For example, we can use it to support extension methods:

    Say we generate a case class Person with a property birthday. We want to add an age function to the class, which calculates the current age from the birthday property. Instead of (unsafely) generating the method into the case class, we can extend the case class with a user-defined trait:

    case class Person(..., birthday: LocalDateTime) extends PersonFunctions

    But how do we define the trait so that it can access the values from Person? Like so:

    trait PersonFunctions { self: Person =>
      def age: Long = self.birthday.until(LocalDateTime.now(), ChronoUnit.DAYS)
    }

    Only problem: We can't reference PersonFunctions in the generator project as a Type, because it needs the Person case class to even compile. So NamedTypeReference allows you to pass a String instead of a Type for this and other use cases.

  11. trait KeyAsIdColumnPlugin extends ColumnPlugin

    This type emitter plugin resolves primary and foreign key columns to the correct raw type:

    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.

  12. trait Literal extends NamingStrategy

    Example (sql name => scala name): some_ident => some_ident

  13. trait LowerCase extends NamingStrategy

    Example (sql name => scala name): SOME_IDENT => some_ident

  14. trait ModelEmitter extends AnyRef

    Handles the transformation of one table to a (case) class.

  15. case class NamedTypeReference(fullName: String, typeArguments: Seq[TypeReference] = Seq.empty) extends TypeReference with Product with Serializable

    A type reference pointing to a type which can not yet be referenced via typeOf, which is the case when you need to reference types that are either generated by inkwell or depend on types generated by inkwell.

    A type reference pointing to a type which can not yet be referenced via typeOf, which is the case when you need to reference types that are either generated by inkwell or depend on types generated by inkwell.

    Example:
    1. Let's say the application (using inkwell) defines an Id[A] type, which represents IDs for any type A. Say you have a table person from which a case class Person is generated. You can resolve the JDBC type of its ID column to Id, but you can not provide the type argument A = Person since Person does not exist until code generation is finished. In such a case, this class can be used to represent the right type for the property.

  16. trait NamingStrategy extends AnyRef
  17. class PartitioningSchemaEmitter extends DefaultSchemaEmitter

    Partitions the schema into different packages based on a partitioning map.

    Partitions the schema into different packages based on a partitioning map. A single model may be included in multiple partitions. Models not included in any partition will be generated into the base package.

  18. trait PropertyEmitter extends AnyRef

    Handles the transformation of one column to a class property.

  19. case class ScalaTypeReference(t: scala.reflect.api.JavaUniverse.Type) extends TypeReference with Product with Serializable

    A type reference pointing to a Scala Type, which is the most natural and safe representation possible.

    A type reference pointing to a Scala Type, which is the most natural and safe representation possible. However, a Type is not always available, in which case you need to choose a different representation.

    Example:
    1. Use this class as follows: import scala.reflect.runtime.universe.typeOf ScalaTypeReference(typeOf[MyType])

  20. trait SchemaEmitter extends AnyRef

    Handles the generation of the whole schema and has the power to decide in which files, objects or even packages specific classes are placed.

  21. class SingleFileSchemaEmitter extends DefaultSchemaEmitter

    Generates the whole schema into a single file.

  22. trait SnakeCaseToCamelCase extends NamingStrategy

    Turns table names to UpperCamelCase and column names to lowerCamelCase.

    Turns table names to UpperCamelCase and column names to lowerCamelCase.

    Model example (sql name => scala name): some_ident => SomeIdent Property example (sql name => scala name): some_ident => someIdent

  23. trait TypeEmitter extends ColumnPlugin

    Provides various ways to turn a type reference into a string.

    Provides various ways to turn a type reference into a string.

    Plugins are defined so that you can mix in proper implementations at your leisure.

  24. trait TypeReference extends AnyRef

    An abstract type reference used by TypeEmitter to resolve a type.

  25. trait UpperCase extends NamingStrategy

    Example (sql name => scala name): some_ident => SOME_IDENT

Ungrouped