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
  3. trait CompilationUnit extends AnyRef

    A single unit of compilation, such as a file.

    A single unit of compilation, such as a file. Each compilation unit may contain many models.

  4. trait CompilationUnitEmitter extends AnyRef
  5. class DefaultCompanionEmitter extends CompanionEmitter
  6. case class DefaultCompilationUnit(fullName: String, models: Set[Model], imports: Set[Import]) extends CompilationUnit with Product with Serializable
  7. class DefaultCompilationUnitEmitter extends CompilationUnitEmitter
  8. case class DefaultModel(table: Table, config: GeneratorConfiguration, inheritances: Inheritances) extends Model with Product with Serializable
  9. class DefaultModelEmitter extends ModelEmitter
  10. case class DefaultProperty(column: Column, model: Model, config: GeneratorConfiguration) extends Property with Product with Serializable
  11. class DefaultPropertyEmitter extends PropertyEmitter
  12. abstract class DefaultSchemaSlicer extends SchemaSlicer
  13. class DefaultTypeEmitter extends TypeEmitter
  14. sealed trait Import extends AnyRef
  15. 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._", "scala.Predef._" and the current compilation unit's package by default, since Scala imports these namespaces by default.

  16. 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.

  17. abstract class KeyAsIdProperty extends DefaultProperty

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

    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.

  18. trait Literal extends NamingStrategy

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

  19. trait LowerCase extends NamingStrategy

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

  20. trait Model extends AnyRef

    Represents a table during transformation to a case class.

  21. trait ModelEmitter extends AnyRef
  22. class ModelRepository extends AnyRef

    A central location to collect all Model objects.

  23. 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.

  24. trait NamingStrategy extends AnyRef
  25. class PartitioningSchemaSlicer extends DefaultSchemaSlicer

    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 only be included in one partition. Models not included in any partition will be generated into the base package.

  26. trait Property extends AnyRef
  27. trait PropertyEmitter extends AnyRef
  28. case class ScalaTypeReference(t: scala.reflect.api.JavaUniverse.Type, typeArguments: Seq[TypeReference]) 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.

    Note that t may not always contain proper type arguments (but instead a wildcard type), since they can be custom-set via typeArguments.

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

  29. trait SchemaSlicer extends AnyRef

    Distributes Model objects via CompilationUnit.

    Distributes Model objects via CompilationUnit. Each model may only be distributed to a single compilation unit.

    Handles the distribution of the whole schema and has the power to decide in which packages specific classes are placed.

  30. class SingleUnitSchemaSlicer extends DefaultSchemaSlicer

    Generates the whole schema into a single unit.

  31. 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

  32. trait TypeEmitter extends AnyRef

    Turns a type reference into a string.

  33. trait TypeReference extends AnyRef

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

  34. trait UpperCase extends NamingStrategy

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

Ungrouped