All Downloads are FREE. Search and download functionalities are using the official Maven repository.

biz.lobachev.annette.data_dictionary.builder.dsl.Entities.scala Maven / Gradle / Ivy

package biz.lobachev.annette.data_dictionary.builder.dsl

import biz.lobachev.annette.data_dictionary.builder.model.{EmbeddedEntity, Entity, StructEntity, TableEntity}
import biz.lobachev.annette.data_dictionary.builder.utils.StringSyntax._

trait Entities {

  def structEntity(id: String, name: String, entityName: String): Entity =
    Entity(
      id = id.trim.pascalCase,
      name = name.trim,
      entityType = StructEntity,
      entityName = entityName.trim.pascalCase,
      tableName = entityName.trim.pluralize.snakeCase
    )

  def tableEntity(id: String, name: String, entityName: String): Entity =
    Entity(
      id = id.trim.pascalCase,
      name = name.trim,
      entityType = TableEntity,
      entityName = entityName.trim.pascalCase,
      tableName = entityName.trim.pluralize.snakeCase
    )

  def embeddedEntity(id: String, name: String, entityName: String): Entity =
    Entity(
      id = id.trim.pascalCase,
      name = name.trim,
      entityType = EmbeddedEntity,
      entityName = entityName.trim.pascalCase,
      tableName = entityName.trim.pluralize.snakeCase
    )

  def structEntity(id: String, name: String): Entity =
    Entity(
      id = id.trim.pascalCase,
      name = name.trim,
      entityType = StructEntity,
      entityName = id.trim.pascalCase,
      tableName = id.trim.pluralize.snakeCase
    )

  def tableEntity(id: String, name: String): Entity =
    Entity(
      id = id.trim.pascalCase,
      name = name.trim,
      entityType = TableEntity,
      entityName = id.trim.pascalCase,
      tableName = id.trim.pluralize.snakeCase
    )

  def embeddedEntity(id: String, name: String): Entity =
    Entity(
      id = id.trim.pascalCase,
      name = name.trim,
      entityType = EmbeddedEntity,
      entityName = id.trim.pascalCase,
      tableName = id.trim.pluralize.snakeCase
    )

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy