Table

zio.blocks.sql.Table
See theTable companion class
object Table

Attributes

Companion
class
Source
Table.scala
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Table.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
Source
Mirror.scala
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Concrete methods

def derived[A](implicit schema: Schema[A]): Table[A]

Derives a Table from A's schema using the default naming policy (TableNamingPolicy.Singular, i.e. CamelCase → snake_case singular).

Derives a Table from A's schema using the default naming policy (TableNamingPolicy.Singular, i.e. CamelCase → snake_case singular).

The table name can be overridden by annotating A with @Modifier.config("sql.table_name", "my_table").

For compile-time SQL dumps, pair with Dump.dumpTable:

case class User(id: Int, name: String)
object User { implicit val schema: Schema[User] = Schema.derived }
val userTable = Table.derived[User]
Dump.dumpTable(userTable) // emits user-postgresql.sql / user-sqlite.sql when -Dzib.sql.dumpDir is set

Attributes

Source
Table.scala
def derived[A](tableName: String)(implicit schema: Schema[A]): Table[A]

Derives a Table from A's schema with an explicit table name, bypassing both the schema annotation and the naming policy.

Derives a Table from A's schema with an explicit table name, bypassing both the schema annotation and the naming policy.

Attributes

Source
Table.scala
def derived[A](namingPolicy: TableNamingPolicy)(implicit schema: Schema[A]): Table[A]

Derives a Table from A's schema using the supplied naming policy to compute the table name (unless overridden by a @Modifier.config annotation).

Derives a Table from A's schema using the supplied naming policy to compute the table name (unless overridden by a @Modifier.config annotation).

Attributes

Source
Table.scala