Column

doobie.Column
See theColumn companion object
case class Column[A](rawName: String, prefix: Option[String])(using read: Read[A], write: Write[A]) extends SQLDefinition[A], TypedFragment[A]

A definition of a single column in the database of type A.

Example:

 object SpecialWeaponStats extends TableDefinition("special_weapon_stats") {
   lazy val userId = Column[UserId]("user_id")
   lazy val weaponId = Column[WeaponGuid]("weapon_id")
   lazy val kills = Column[WeaponKills]("kills")
 }

Value parameters

prefix

the prefix of the table that this column belongs to, if specified. This is Some after you use prefixedWith.

rawName

the name of the column in the database

Attributes

Companion
object
Source
Column.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait TypedFragment[A]
trait SQLDefinition[A]
class Object
trait Matchable
class Any
Show all
Self type
Column[A]

Members list

Type members

Types

type Result = A

Used in dependent type expressions.

Used in dependent type expressions.

Attributes

Source
SQLDefinition.scala
type Self[X] <: SQLDefinition[X]

Attributes

Source
SQLDefinition.scala
override type Self[X] = Column[X]

Attributes

Source
Column.scala

Inherited types

type Result = A

Used in dependent type expressions.

Used in dependent type expressions.

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala

Value members

Abstract methods

def ===(value: A): TypedFragment[Boolean]

Returns the SQL which evaluates to true if all columns of this SQLDefinition are equal to the given value.

Returns the SQL which evaluates to true if all columns of this SQLDefinition are equal to the given value.

Attributes

Source
SQLDefinition.scala
def ==>(value: A): NonEmptyVector[(Fragment, Fragment)]

Converts the value into a vector of (columnName, value) pairs.

Converts the value into a vector of (columnName, value) pairs.

Attributes

Source
SQLDefinition.scala

Vector of columns

Vector of columns

Attributes

Source
SQLDefinition.scala
def prefixedWith(prefix: String): Self[A]

Prefixes all column names with prefix.. If this already had a prefix, the prefix is replaced.

Prefixes all column names with prefix.. If this already had a prefix, the prefix is replaced.

Attributes

Source
SQLDefinition.scala
def read: Read[A]

Attributes

Source
SQLDefinition.scala
def write: Write[A]

Attributes

Source
SQLDefinition.scala

Concrete methods

def !==(a: A): TypedFragment[Boolean]

Returns a column_name <> $a Fragment.

Returns a column_name <> $a Fragment.

Attributes

Source
Column.scala

Returns a column_name <> $a Fragment.

Returns a column_name <> $a Fragment.

Attributes

Source
Column.scala
def +(a: A): TypedFragment[A]

Attributes

Source
Column.scala
def +(a: TypedFragment[A]): TypedFragment[A]

Attributes

Source
Column.scala
def -(a: A): TypedFragment[A]

Attributes

Source
Column.scala
def -(a: TypedFragment[A]): TypedFragment[A]

Attributes

Source
Column.scala
inline def -->(a: A): (Fragment, Fragment)

Returns a tuple of (column_name, A).

Returns a tuple of (column_name, A).

Attributes

Source
Column.scala
inline def -->(a: TypedFragment[A]): (Fragment, Fragment)

Returns a tuple of (column_name, A).

Returns a tuple of (column_name, A).

Attributes

Source
Column.scala
def <(a: A): TypedFragment[Boolean]

Attributes

Source
Column.scala

Attributes

Source
Column.scala
def <=(a: A): TypedFragment[Boolean]

Attributes

Source
Column.scala

Attributes

Source
Column.scala
def ===(a: A): TypedFragment[Boolean]

Returns a column_name = $a Fragment.

Returns a column_name = $a Fragment.

Attributes

Source
Column.scala

Returns a column_name = $a Fragment.

Returns a column_name = $a Fragment.

Attributes

Source
Column.scala

Converts the value into a vector of (columnName, value) pairs.

Converts the value into a vector of (columnName, value) pairs.

Attributes

Source
Column.scala
def >(a: A): TypedFragment[Boolean]

Attributes

Source
Column.scala

Attributes

Source
Column.scala
def >=(a: A): TypedFragment[Boolean]

Attributes

Source
Column.scala

Attributes

Source
Column.scala

Returns Update for batch inserts into the given table.

Returns Update for batch inserts into the given table.

Attributes

Source
SQLDefinition.scala

Attributes

Source
SQLDefinition.scala
override def fragment: Fragment

Attributes

Definition Classes
Source
Column.scala
def in[F[_]](values: F[A])(using Reducible[F], Write[A]): TypedFragment[Boolean]

Returns a column_name IN ($values) Fragment.

Returns a column_name IN ($values) Fragment.

Attributes

Source
Column.scala
def in(values: IterableOnce[A])(using Write[A]): TypedFragment[Boolean]

Returns column_name IN (fs0, fs1, ...) if there were elements or FALSE otherwise.

Returns column_name IN (fs0, fs1, ...) if there were elements or FALSE otherwise.

Attributes

Source
Column.scala

Full SQL for inserting into the given table.

Full SQL for inserting into the given table.

Attributes

Source
SQLDefinition.scala
Extension method from Column

Attributes

Source
Column.scala
Extension method from Column

Attributes

Source
Column.scala
def notIn[F[_]](values: F[A])(using Reducible[F], Write[A]): TypedFragment[Boolean]

Returns a column_name NOT IN ($values) Fragment.

Returns a column_name NOT IN ($values) Fragment.

Attributes

Source
Column.scala
def notIn(values: IterableOnce[A])(using Write[A]): TypedFragment[Boolean]

Returns column_name NOT IN (fs0, fs1, ...) if there were elements or TRUE otherwise.

Returns column_name NOT IN (fs0, fs1, ...) if there were elements or TRUE otherwise.

Attributes

Source
Column.scala
def option[B](using ng: NotGiven[A =:= Option[B]]): Column[Option[A]]

Creates an Option version of the Column, giving that it is not already an Option.

Creates an Option version of the Column, giving that it is not already an Option.

Attributes

Source
Column.scala
override def prefixedWith(prefix: String): Column[A]

Prefixes all column names with prefix.. If this already had a prefix, the prefix is replaced.

Prefixes all column names with prefix.. If this already had a prefix, the prefix is replaced.

Attributes

Definition Classes
Source
Column.scala
inline def setTo(a: A): Fragment

For use in UPDATE table_name SET name = ? queries.

For use in UPDATE table_name SET name = ? queries.

Attributes

Source
Column.scala
inline def setTo(a: TypedFragment[A]): Fragment

For use in UPDATE table_name SET name = ? queries.

For use in UPDATE table_name SET name = ? queries.

Attributes

Source
Column.scala
Extension method from Column

Attributes

Source
Column.scala
inline def sqlDef: SQLDefinition[A]

To allow widening the type of Column and similar ones to SQLDefinition.

To allow widening the type of Column and similar ones to SQLDefinition.

This is useful when working with tuples of SQLDefinitions, because (Column[Int], Column[String]) is not the same thing as (SQLResult[Int], SQLResult[String]).

Attributes

Source
SQLDefinition.scala

Inherited methods

Returns Update for batch inserts into the given table.

Returns Update for batch inserts into the given table.

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala

Full SQL for inserting into the given table.

Full SQL for inserting into the given table.

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product
inline def sqlDef: SQLDefinition[A]

To allow widening the type of Column and similar ones to SQLDefinition.

To allow widening the type of Column and similar ones to SQLDefinition.

This is useful when working with tuples of SQLDefinitions, because (Column[Int], Column[String]) is not the same thing as (SQLResult[Int], SQLResult[String]).

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala
inline def tmf: TypedMultiFragment[A]

To allow widening the type of Column and similar ones to TypedMultiFragment.

To allow widening the type of Column and similar ones to TypedMultiFragment.

This is useful when working with tuples of TypedMultiFragments, because (Column[Int], Column[String]) is not the same thing as (TypedMultiFragment[Int], TypedMultiFragment[String]).

Attributes

Inherited from:
TypedMultiFragment
Source
TypedMultiFragment.scala
inline def tmf: TypedMultiFragment[A]

To allow widening the type of Column and similar ones to TypedMultiFragment.

To allow widening the type of Column and similar ones to TypedMultiFragment.

This is useful when working with tuples of TypedMultiFragments, because (Column[Int], Column[String]) is not the same thing as (TypedMultiFragment[Int], TypedMultiFragment[String]).

Attributes

Inherited from:
TypedMultiFragment
Source
TypedMultiFragment.scala

Concrete fields

lazy override val columns: NonEmptyVector[Column[_]]

Vector of columns

Vector of columns

Attributes

Source
Column.scala
lazy val columnsSql: Fragment

The SQL Fragment containing all of the Column.name joined with ",".

The SQL Fragment containing all of the Column.name joined with ",".

Useful in preparing batch inserts.

 Update[Person](
   sql"INSERT INTO $personTable (${person.columnsSql}) VALUES (${person.valuesSql})".rawSql
 ).updateMany(persons)

Attributes

Source
SQLDefinition.scala
lazy val excluded: Self[A]

Prefixes all column names with EXCLUDED, which is a special SQL table name when resolving insert/update conflicts.

Prefixes all column names with EXCLUDED, which is a special SQL table name when resolving insert/update conflicts.

Example:

 sql"""
    ${t.Row.insertSqlFor(t)}
    ON CONFLICT (${t.userId}, ${t.weaponId}) DO UPDATE SET ${t.kills} = ${t.kills} + ${t.kills.excluded}
 """

Attributes

Source
SQLDefinition.scala
lazy val get: Get[A]

Returns the Get that is backing the read.

Returns the Get that is backing the read.

Attributes

Source
Column.scala
lazy val insertSql: Fragment

Combines columnsSql and valuesSql.

Combines columnsSql and valuesSql.

Useful in preparing batch inserts.

 Update[Person](
   sql"INSERT INTO $personTable ${person.insertSql}".rawSql
 ).updateMany(persons)

Attributes

Source
SQLDefinition.scala
val name: Fragment

Attributes

Source
Column.scala
lazy val put: Put[A]

Returns the Put that is backing the write.

Returns the Put that is backing the write.

Attributes

Source
Column.scala
lazy val sql: Fragment

SQL that lists all of the columns to get this SQL result.

SQL that lists all of the columns to get this SQL result.

Attributes

Source
SQLDefinition.scala
lazy val valuesSql: Fragment

The SQL Fragment containing as many value placeholders (?) as there are columns joined with ",".

The SQL Fragment containing as many value placeholders (?) as there are columns joined with ",".

Useful in preparing batch inserts. See columnsSql.

Attributes

Source
SQLDefinition.scala

Inherited fields

lazy val columnsSql: Fragment

The SQL Fragment containing all of the Column.name joined with ",".

The SQL Fragment containing all of the Column.name joined with ",".

Useful in preparing batch inserts.

 Update[Person](
   sql"INSERT INTO $personTable (${person.columnsSql}) VALUES (${person.valuesSql})".rawSql
 ).updateMany(persons)

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala
lazy val excluded: Column[A]

Prefixes all column names with EXCLUDED, which is a special SQL table name when resolving insert/update conflicts.

Prefixes all column names with EXCLUDED, which is a special SQL table name when resolving insert/update conflicts.

Example:

 sql"""
    ${t.Row.insertSqlFor(t)}
    ON CONFLICT (${t.userId}, ${t.weaponId}) DO UPDATE SET ${t.kills} = ${t.kills} + ${t.kills.excluded}
 """

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala
lazy val insertSql: Fragment

Combines columnsSql and valuesSql.

Combines columnsSql and valuesSql.

Useful in preparing batch inserts.

 Update[Person](
   sql"INSERT INTO $personTable ${person.insertSql}".rawSql
 ).updateMany(persons)

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala
lazy val sql: Fragment

SQL that lists all of the columns to get this SQL result.

SQL that lists all of the columns to get this SQL result.

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala
lazy val valuesSql: Fragment

The SQL Fragment containing as many value placeholders (?) as there are columns joined with ",".

The SQL Fragment containing as many value placeholders (?) as there are columns joined with ",".

Useful in preparing batch inserts. See columnsSql.

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala

Givens

Givens

given given_Read_A: Read[A]

Attributes

Source
SQLDefinition.scala
given given_Write_A: Write[A]

Attributes

Source
SQLDefinition.scala
given read: Read[A]

Attributes

Source
Column.scala
given write: Write[A]

Attributes

Source
Column.scala

Inherited givens

given given_Read_A: Read[A]

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala
given given_Write_A: Write[A]

Attributes

Inherited from:
SQLDefinition
Source
SQLDefinition.scala