doobie

package doobie

Members list

Type members

Classlikes

case class AliasedTableDefinition[T <: TableDefinition](name: Fragment, alias: String, original: T) extends TableName

Result of TableDefinition.as.

Result of TableDefinition.as.

Value parameters

alias

the alias of the table, for example "u".

name

the name of the table with the alias, for example "users AS u".

original

the original TableDefinition.

Attributes

Source
TableDefinition.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TableName
class Object
trait Matchable
class Any
Show all
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.

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
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]
object Column

Attributes

Companion
class
Source
Column.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Column.type
case class Columns[+QueryResult]

Allows you to select columns in a type-safe way.

Allows you to select columns in a type-safe way.

Example:

 val columns = Columns((nameCol.tmf, ageCol.tmf, pet1Col.tmf, pet2Col.tmf))
 val resultQuery: Query0[(String, Int, String, Option[String])] =
   sql"SELECT $columns FROM $personWithPetsTable".queryOf(columns)

Type parameters

QueryResult

the type of Fragment.queryOf(columns) expression.

Value parameters

sql

returns the names of the columns, for example "name, surname, age".

Attributes

Companion
object
Source
Columns.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Columns

Attributes

Companion
class
Source
Columns.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Columns.type
object Composite

Attributes

Source
Composite.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Composite.type
final implicit class FragmentExtensions(fragment: Fragment) extends AnyVal

Attributes

Source
FragmentExtensions.scala
Supertypes
class AnyVal
trait Matchable
class Any
case class MkFragmentsResult(fragment: Fragment, hadElements: Boolean)

Attributes

Source
extensions.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait SQLDefinition[A] extends TypedMultiFragment[A]

An SQL definition that produces a value of type A.

An SQL definition that produces a value of type A.

The definition can be either:

Attributes

Companion
object
Source
SQLDefinition.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Column[A]
Self type
object SQLDefinition

Attributes

Companion
trait
Source
SQLDefinition.scala
Supertypes
class Object
trait Matchable
class Any
Self type
class TableDefinition(val rawName: String) extends TableName

Defines a table.

Defines a table.

Example:

 object Users extends TableDefinition("users") {
   val id = Column[Int]("id")
 }

Value parameters

rawName

the name in database of the table.

Attributes

Companion
object
Source
TableDefinition.scala
Supertypes
trait TableName
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
TableDefinition.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait TableName

Attributes

Companion
object
Source
TableDefinition.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object TableName

Attributes

Companion
trait
Source
TableDefinition.scala
Supertypes
class Object
trait Matchable
class Any
Self type
TableName.type
trait TypedFragment[+A] extends TypedMultiFragment[A]

A doobie fragment that refers to a single column/value which produces a value of type A.

A doobie fragment that refers to a single column/value which produces a value of type A.

Attributes

Companion
object
Source
TypedFragment.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Column[A]
object TypedFragment

Attributes

Companion
trait
Source
TypedFragment.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait TypedMultiFragment[+A]

A doobie fragment that potentially refers to a multiple columns/values (such as SQLDefinition) which produces a value of type A.

A doobie fragment that potentially refers to a multiple columns/values (such as SQLDefinition) which produces a value of type A.

Exists so that Columns could support Column, SQLDefinition, TypedFragment and TypedMultiFragment.

Attributes

Companion
object
Source
TypedMultiFragment.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait SQLDefinition[A]
class Column[A]
trait TypedFragment[A]

Attributes

Companion
trait
Source
TypedMultiFragment.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Source
extensions.scala
Supertypes
class Object
trait Matchable
class Any
trait WithSQLDefinition[A](val sqlDefinition: SQLDefinition[A]) extends SQLDefinition[A]

Allows you to inline a SQLDefinition.

Allows you to inline a SQLDefinition.

This is useful when you want to expose the Read and Write of the A in the companion object.

Example:

 case class Row(matchId: MatchId, userData: UserData)
 object Row extends WithSQLDefinition[Row](Composite((
   matchId.sqlDef, UserData.sqlDef
 ))(Row.apply)(Tuple.fromProductTyped))

Attributes

Source
WithSQLDefinition.scala
Supertypes
trait SQLDefinition[A]
class Object
trait Matchable
class Any

Value members

Concrete methods

def insertInto[F[_]](table: TableName, columns: F[(Fragment, Fragment)])(using Reducible[F], Pos): Fragment

Generates the SQL for INSERT INTO table (column1, column2, ...) VALUES (value1, value2, ...).

Generates the SQL for INSERT INTO table (column1, column2, ...) VALUES (value1, value2, ...).

Example:

 insertInto(tables.InventoryCharacters, NonEmptyVector.of(
   tables.InventoryCharacters.userId --> c.userId,
   tables.InventoryCharacters.guid --> c.guid
 ))

Attributes

Source
fragments.scala
def updateTable[F[_]](table: TableName, columns: F[(Fragment, Fragment)])(using Reducible[F], Pos): Fragment

Generates the SQL for UPDATE table SET column1 = value1, column2 = value2, ....

Generates the SQL for UPDATE table SET column1 = value1, column2 = value2, ....

Example:

 updateTable(tables.InventoryCharacters, NonEmpty.createVector(
   tables.InventoryCharacters.handgun1 --> loadouts.sets.set1.weapons.handgun,
   tables.InventoryCharacters.handgun2 --> loadouts.sets.set2.weapons.handgun
 ))

Attributes

Source
fragments.scala
def updateTable(table: TableName, column1: (Fragment, Fragment), other: (Fragment, Fragment)*)(using Pos): Fragment

Overload of updateTable for convenience.

Overload of updateTable for convenience.

Attributes

Source
fragments.scala

Extensions

Extensions

extension [F[_], A](fa: F[A])(fa: F[A])(using Foldable[F])
def mapIntercalate[B](starting: B, separator: B)(f: (B, A) => B)(using semi: Semigroup[B]): B

Example:

Example:

 List(1, 2, 3).mapIntercalate("Words: ", ", ")((str, num) => s"$str$num")
 // "Words: 1, 2, 3"

Value parameters

separator

the values that go between the elements

starting

the starting value

Attributes

Source
extensions.scala
extension (iterable: IterableOnce[Fragment])(iterable: IterableOnce[Fragment])
def mkFragments(separator: Fragment): Fragment

Attributes

Source
extensions.scala

Attributes

Source
extensions.scala
extension [A](iterable: IterableOnce[A])(iterable: IterableOnce[A])(using Write[A])
def mkFragments(separator: Fragment): Fragment

Attributes

Source
extensions.scala

Attributes

Source
extensions.scala
extension (iterator: Iterator[Fragment])(iterator: Iterator[Fragment])
def mkFragments(separator: Fragment): Fragment

Attributes

Source
extensions.scala

Attributes

Source
extensions.scala
extension [A](iterator: Iterator[A])(iterator: Iterator[A])(using Write[A])
def mkFragments(separator: Fragment): Fragment

Attributes

Source
extensions.scala

Attributes

Source
extensions.scala

Implicits

Implicits

final implicit def FragmentExtensions(fragment: Fragment): FragmentExtensions

Attributes

Source
FragmentExtensions.scala