TableQuery

ldbc.statement.TableQuery
See theTableQuery companion object
trait TableQuery[A, O]

Trait for constructing SQL Statement from Table information.

Type parameters

A

The type of Table. in the case of Join, it is a Tuple of type Table.

O

The type of Optional Table. in the case of Join, it is a Tuple of type Optional Table.

Attributes

Companion
object
Source
TableQuery.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class On[A, B, AB, OO]

Members list

Type members

Types

type Entity = Extract[A]

Attributes

Source
TableQuery.scala

Value members

Abstract methods

def name: String

Name of Table

Name of Table

Attributes

Source
TableQuery.scala

Concrete methods

inline def ++=(head: Entity, tail: Entity*): Insert[A]

Method to construct a query to insert a table.

Method to construct a query to insert a table.

 TableQuery[City] ++= List(City(1L, "Tokyo"), City(2L, "Osaka"))

Value parameters

head

Value to be inserted into the table

tail

Value to be inserted into the table

Attributes

Source
TableQuery.scala
inline def ++=(values: NonEmptyList[Entity]): Insert[A]

Method to construct a query to insert a table.

Method to construct a query to insert a table.

 TableQuery[City] ++= NonEmptyList(City(1L, "Tokyo"), City(2L, "Osaka"))

Value parameters

values

Value to be inserted into the table

Attributes

Source
TableQuery.scala
inline def +=(value: Entity): Insert[A]

Method to construct a query to insert a table.

Method to construct a query to insert a table.

 TableQuery[City] += City(1L, "Tokyo")

Value parameters

value

Value to be inserted into the table

Attributes

Source
TableQuery.scala
def delete: Delete[A]

Method to construct a query to delete a table.

Method to construct a query to delete a table.

 TableQuery[City]
   .delete

Attributes

Source
TableQuery.scala
inline def insert(using mirror: Of[Entity])(head: mirror.MirroredElemTypes, tail: mirror.MirroredElemTypes*): Insert[A]

Method to construct a query to insert a table.

Method to construct a query to insert a table.

 TableQuery[City]
   .insert((1L, "Tokyo"))

Value parameters

head

Value to be inserted into the table

mirror

Mirror of Entity

tail

Value to be inserted into the table

Attributes

Source
TableQuery.scala
inline def insertInto[C](func: A => Column[C]): Into[A, C]

Method to construct a query to insert a table.

Method to construct a query to insert a table.

 TableQuery[City]
   .insertInto(city => city.id *: city.name)
   .values((1L, "Tokyo"))

If you want to use a join, consider using select as follows

  TableQuery[City]
    .insertInto(city => city.id *: city.name)
    .select(
      TableQuery[Country]
        .join(TableQuery[City])
        .on((country, city) => country.id === city.countryId)
        .select((country, city) => country.id *: city.name)
        .where((country, city) => city.population > 1000000)
    )

Type parameters

C

Scala types to be converted by Encoder

Value parameters

func

Function to construct an expression using the columns that Table has.

Attributes

Source
TableQuery.scala
def join[B, BO, AB, OO](other: TableQuery[B, BO])(using Aux[A, B, AB], Aux[O, BO, OO]): Join[A, B, AB, OO]

Method to construct a query to join a table.

Method to construct a query to join a table.

 TableQuery[City]
   .join(TableQuery[Country])
   .on((city, country) => city.countryId === country.id)

Attributes

Source
TableQuery.scala
def leftJoin[B, BO, OB, OO](other: TableQuery[B, BO])(using Aux[A, BO, OB], Aux[O, BO, OO]): Join[A, B, OB, OO]

Method to construct a query to left join a table.

Method to construct a query to left join a table.

 TableQuery[City]
   .leftJoin(TableQuery[Country])
   .on((city, country) => city.countryId === country.id)

Attributes

Source
TableQuery.scala
def rightJoin[B, BO, OB, OO](other: TableQuery[B, BO])(using Aux[O, B, OB], Aux[O, BO, OO]): Join[A, B, OB, OO]

Method to construct a query to right join a table.

Method to construct a query to right join a table.

 TableQuery[City]
   .rightJoin(TableQuery[Country])
   .on((city, country) => city.countryId === country.id)

Attributes

Source
TableQuery.scala
def schema: Schema

Function to return a Schema object for executing DDL.

Function to return a Schema object for executing DDL.

 TableQuery[City].schema

Attributes

Source
TableQuery.scala
def select[C](func: A => Column[C]): Select[A, C]

Method to construct a query to select a table.

Method to construct a query to select a table.

 TableQuery[City]
   .select(city => city.id *: city.name)

Type parameters

C

Scala types to be converted by Decoder

Value parameters

func

Function to construct an expression using the columns that Table has.

Attributes

Source
TableQuery.scala

Method to construct a query to select all columns of a table.

Method to construct a query to select all columns of a table.

 TableQuery[City]
   .selectAll

Attributes

Source
TableQuery.scala
inline def update[C](func: A => Column[C])(values: C): Update[A]

Method to construct a query to update a table.

Method to construct a query to update a table.

 TableQuery[City]
   .update(city => city.id *: city.name)((1L, "Tokyo"))

Type parameters

C

Scala types to be converted by Encoder

Value parameters

func

Function to construct an expression using the columns that Table has.

values

Value to be updated in the table

Attributes

Source
TableQuery.scala
def update(value: Entity): Update[A]

Method to construct a query to update a table.

Method to construct a query to update a table.

 TableQuery[City]
   .update(City(1L, "Tokyo"))

Value parameters

value

Value to be updated in the table

Attributes

Source
TableQuery.scala