scalasql.query

package scalasql.query

Members list

Type members

Classlikes

class Aggregate[Q, R](toSqlStr0: Context => SqlStr, construct0: ResultSetIterator => R, val expr: Q, val qr: Queryable[Q, R]) extends DelegateQueryable[Q, R]

Attributes

Supertypes
trait DelegateQueryable[Q, R]
trait WithSqlExpr[Q]
trait Query[R]
trait Renderable
class Object
trait Matchable
class Any
Show all
sealed trait AscDesc

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Asc
object Desc
object AscDesc

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
AscDesc.type
class Column[T](tableRef: TableRef, val name: String)(implicit val mappedType: TypeMapper[T]) extends Expr[T]

A variant of Expr representing a raw table column; allows assignment in updates and inserts

A variant of Expr representing a raw table column; allows assignment in updates and inserts

Attributes

Companion
object
Supertypes
trait Expr[T]
trait Renderable
class Object
trait Matchable
class Any
object Column

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Column.type
class CompoundSelect[Q, R](val lhs: SimpleSelect[Q, R], val compoundOps: Seq[Op[Q, R]], val orderBy: Seq[OrderBy], val limit: Option[Int], val offset: Option[Int])(implicit val qr: Row[Q, R], val dialect: DialectTypeMappers) extends Proxy[Q, R]

A SQL SELECT query, with ORDER BY, LIMIT, OFFSET, or UNION clauses

A SQL SELECT query, with ORDER BY, LIMIT, OFFSET, or UNION clauses

Attributes

Companion
object
Supertypes
trait Proxy[Q, R]
trait Select[Q, R]
trait Wrapped
trait DelegateQueryable[Q, Seq[R]]
trait Query[Seq[R]]
trait JoinOps[Select, Q, R]
trait Joinable[Q, R]
trait Aggregatable[Q]
trait WithSqlExpr[Q]
trait Renderable
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
trait Delete[Q] extends ExecuteUpdate[Int], Base[Q]

A SQL DELETE query

A SQL DELETE query

Attributes

Companion
object
Supertypes
trait Base[Q]
trait WithSqlExpr[Q]
trait ExecuteUpdate[Int]
trait Query[Int]
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Impl[Q]
object Delete

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Delete.type
object FlatJoin

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
FlatJoin.type
trait GetGeneratedKeys[Q, R] extends Query[Seq[R]]

Represents an Insert query that you want to call JdbcStatement.getGeneratedKeys on to retrieve any auto-generated primary key values from the results

Represents an Insert query that you want to call JdbcStatement.getGeneratedKeys on to retrieve any auto-generated primary key values from the results

Attributes

Companion
object
Supertypes
trait Query[Seq[R]]
trait Renderable
class Object
trait Matchable
class Any
Known subtypes
class Impl[Q, R]

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
case class GroupBy(keys: Seq[Expr[_]], select: () => Select[_, _], having: Seq[Expr[_]])

Models a SQL GROUP BY clause

Models a SQL GROUP BY clause

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait Insert[V[_[_]], R] extends WithSqlExpr[V[Column]], Insert[V, R]

A SQL INSERT query

A SQL INSERT query

Attributes

Companion
object
Supertypes
trait Insert[V, R]
trait WithSqlExpr[V[Column]]
class Object
trait Matchable
class Any
Known subtypes
class Impl[V, R]
object Insert

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Insert.type
trait InsertColumns[V[_[_]], R] extends InsertBase[V[Column]], ExecuteUpdate[Int]

A SQL INSERT VALUES query

A SQL INSERT VALUES query

Attributes

Companion
object
Supertypes
trait ExecuteUpdate[Int]
trait Query[Int]
trait InsertBase[V[Column]]
trait Base[V[Column]]
trait WithSqlExpr[V[Column]]
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Impl[V, R]
object InsertColumns

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait InsertSelect[V[_[_]], C, R, R2] extends InsertBase[V[Column]], ExecuteUpdate[Int]

A SQL INSERT SELECT query

A SQL INSERT SELECT query

Attributes

Companion
object
Supertypes
trait ExecuteUpdate[Int]
trait Query[Int]
trait InsertBase[V[Column]]
trait Base[V[Column]]
trait WithSqlExpr[V[Column]]
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Impl[V, C, R, R2]
object InsertSelect

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait InsertValues[V[_[_]], R] extends InsertBase[V[Column]], ExecuteUpdate[Int]

Attributes

Companion
object
Supertypes
trait ExecuteUpdate[Int]
trait Query[Int]
trait InsertBase[V[Column]]
trait Base[V[Column]]
trait WithSqlExpr[V[Column]]
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Impl[V, R]
object InsertValues

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
case class Join(prefix: String, from: Seq[From])

Models a SQL JOIN clause

Models a SQL JOIN clause

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Join

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Join.type
trait JoinAppend[Q, Q2, QF, RF]

Typeclass to allow .join to append tuples, such that Query[(A, B)].join(Query[C]) returns a flat Query[(A, B, C)] rather than a nested Query[((A, B), B)]. Can't eliminate nesting in all cases, but eliminates nesting often enough to be useful

Typeclass to allow .join to append tuples, such that Query[(A, B)].join(Query[C]) returns a flat Query[(A, B, C)] rather than a nested Query[((A, B), B)]. Can't eliminate nesting in all cases, but eliminates nesting often enough to be useful

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object JoinAppend extends JoinAppend

Attributes

Companion
trait
Supertypes
trait JoinAppend
class Object
trait Matchable
class Any
Self type
JoinAppend.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait JoinAppend
object JoinAppend
trait JoinOps[C[_, _], Q, R] extends WithSqlExpr[Q]

Attributes

Companion
object
Supertypes
trait WithSqlExpr[Q]
class Object
trait Matchable
class Any
Known subtypes
trait Select[Q, R]
trait Proxy[Q, R]
class CompoundSelect[Q, R]
class Values[Q, R]
class WithCte[Q, R]
class Proxy[Q, R]
class SimpleSelect[Q, R]
trait Update[Q, R]
class Impl[Q, R]
Show all
object JoinOps

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
JoinOps.type
trait Joinable[Q, R]

Something that can be joined; typically a Select or a Table

Something that can be joined; typically a Select or a Table

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Select[Q, R]
trait Proxy[Q, R]
class CompoundSelect[Q, R]
class Values[Q, R]
class WithCte[Q, R]
class Proxy[Q, R]
class SimpleSelect[Q, R]
Show all
object Joinable

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Joinable.type
class LateralJoinOps[C[_, _], Q, R](wrapped: JoinOps[C, Q, R] & Joinable[Q, R])(implicit qr: Row[Q, R])

Wrapper class with extension methods to add support for JOIN LATERAL, which allow for JOIN clauses to access the results of earlier JOIN and FROM clauses. Only supported by Postgres and MySql

Wrapper class with extension methods to add support for JOIN LATERAL, which allow for JOIN clauses to access the results of earlier JOIN and FROM clauses. Only supported by Postgres and MySql

Attributes

Supertypes
class Object
trait Matchable
class Any
sealed trait Nulls

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object First
object Last
object Nulls

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Nulls.type
class OnConflict[Q, R](query: Query[R] & InsertBase[Q], expr: Q, table: TableRef)

A query with a SQL ON CONFLICT clause, typically an INSERT or an UPDATE

A query with a SQL ON CONFLICT clause, typically an INSERT or an UPDATE

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object OnConflict

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
OnConflict.type
case class OrderBy(expr: Expr[_], ascDesc: Option[AscDesc], nulls: Option[Nulls])

Models a SQL ORDER BY clause

Models a SQL ORDER BY clause

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait Query[R] extends Renderable

A SQL Query, either a Query.Multiple that returns multiple rows, or a Query.Single that returns a single row

A SQL Query, either a Query.Multiple that returns multiple rows, or a Query.Single that returns a single row

Attributes

Companion
object
Supertypes
trait Renderable
class Object
trait Matchable
class Any
Known subtypes
trait GetGeneratedKeys[Q, R]
class Impl[Q, R]
trait DelegateQuery[R]
class Ignore[Q, R]
class Update[Q, R]
class Single[R]
trait DelegateQueryable[Q, R]
class Aggregate[Q, R]
trait Returning[Q, R]
class Impl[Q, R]
class Impl0[Q, R]
class InsertImpl[Q, R]
trait Select[Q, R]
trait Proxy[Q, R]
class CompoundSelect[Q, R]
class Values[Q, R]
class WithCte[Q, R]
class Proxy[Q, R]
class SimpleSelect[Q, R]
trait ExecuteUpdate[R]
trait Delete[Q]
class Impl[Q]
trait InsertColumns[V, R]
class Impl[V, R]
trait InsertSelect[V, C, R, R2]
class Impl[V, C, R, R2]
trait InsertValues[V, R]
class Impl[V, R]
trait Update[Q, R]
class Impl[Q, R]
Show all
object Query

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Query.type
trait Returning[Q, R] extends Query[Seq[R]], DelegateQueryable[Q, Seq[R]]

A query with a RETURNING clause

A query with a RETURNING clause

Attributes

Companion
object
Supertypes
trait DelegateQueryable[Q, Seq[R]]
trait WithSqlExpr[Q]
trait Query[Seq[R]]
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Impl[Q, R]
class Impl0[Q, R]
class InsertImpl[Q, R]
object Returning

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Returning.type
trait Select[Q, R] extends Renderable, Aggregatable[Q], Joinable[Q, R], JoinOps[Select, Q, R], Query[Seq[R]], DelegateQueryable[Q, Seq[R]], Wrapped

A SQL SELECT query, possible with JOIN, WHERE, GROUP BY, ORDER BY, LIMIT, OFFSET clauses

A SQL SELECT query, possible with JOIN, WHERE, GROUP BY, ORDER BY, LIMIT, OFFSET clauses

Models the various components of a SQL SELECT:

SELECT DISTINCT column, AGG_FUNC(column_or_expression), …
FROM mytable
JOIN another_table ON mytable.column = another_table.column
WHERE constraint_expression
GROUP BY column HAVING constraint_expression
ORDER BY column ASC/DESC
LIMIT count OFFSET COUNT;

Good syntax reference:

https://www.cockroachlabs.com/docs/stable/selection-queries#set-operations https://www.postgresql.org/docs/current/sql-select.html

Attributes

Companion
object
Supertypes
trait Wrapped
trait DelegateQueryable[Q, Seq[R]]
trait Query[Seq[R]]
trait JoinOps[Select, Q, R]
trait Joinable[Q, R]
trait Aggregatable[Q]
trait WithSqlExpr[Q]
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Proxy[Q, R]
class CompoundSelect[Q, R]
class Values[Q, R]
class WithCte[Q, R]
class Proxy[Q, R]
class SimpleSelect[Q, R]
Show all
object Select

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Select.type
class SimpleSelect[Q, R](val expr: Q, val exprPrefix: Option[Context => SqlStr], val exprSuffix: Option[Context => SqlStr], val preserveAll: Boolean, val from: Seq[From], val joins: Seq[Join], val where: Seq[Expr[_]], val groupBy0: Option[GroupBy])(implicit val qr: Row[Q, R], val dialect: DialectTypeMappers) extends Select[Q, R]

A SELECT query, with FROM/JOIN/WHERE/GROUP BY clauses, but without ORDER BY/LIMIT/TAKE/UNION clauses

A SELECT query, with FROM/JOIN/WHERE/GROUP BY clauses, but without ORDER BY/LIMIT/TAKE/UNION clauses

Attributes

Companion
object
Supertypes
trait Select[Q, R]
trait Wrapped
trait DelegateQueryable[Q, Seq[R]]
trait Query[Seq[R]]
trait JoinOps[Select, Q, R]
trait Joinable[Q, R]
trait Aggregatable[Q]
trait WithSqlExpr[Q]
trait Renderable
class Object
trait Matchable
class Any
Show all
object SimpleSelect

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class SqlWindow[T](e: Expr[T], partitionBy0: Option[Expr[_]], filter0: Option[Expr[Boolean]], orderBy: Seq[OrderBy], frameStart0: Option[SqlStr], frameEnd0: Option[SqlStr], exclusions: Option[SqlStr])(implicit dialect: DialectTypeMappers) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
trait Renderable
class Object
trait Matchable
class Any
Show all
class SubqueryRef(val value: Wrapped) extends From

Models a subquery: a SELECT, VALUES, nested WITH, etc.

Models a subquery: a SELECT, VALUES, nested WITH, etc.

Attributes

Companion
object
Supertypes
trait From
class Object
trait Matchable
class Any
object SubqueryRef

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
abstract class Table[V[_[_]]]()(implicit name: Name, metadata0: Metadata[V]) extends Base, LowPri[V]

In-code representation of a SQL table, associated with a given case class V.

In-code representation of a SQL table, associated with a given case class V.

Attributes

Companion
object
Supertypes
trait LowPri[V]
trait Base
class Object
trait Matchable
class Any
object Table

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Table.type
object TableMacros

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait TableMacros

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Metadata
class TableRef(val value: Base) extends From

Models a SQL FROM clause

Models a SQL FROM clause

Attributes

Supertypes
trait From
class Object
trait Matchable
class Any
trait Update[Q, R] extends JoinOps[Update, Q, R], Base[Q], ExecuteUpdate[Int]

A SQL UPDATE query

A SQL UPDATE query

Attributes

Companion
object
Supertypes
trait ExecuteUpdate[Int]
trait Query[Int]
trait Base[Q]
trait Renderable
trait JoinOps[Update, Q, R]
trait WithSqlExpr[Q]
class Object
trait Matchable
class Any
Show all
Known subtypes
class Impl[Q, R]
object Update

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Update.type
class Values[Q, R](val ts: Seq[R])(implicit val qr: Row[Q, R], val dialect: DialectTypeMappers) extends Proxy[Q, R], DelegateQueryable[Q, Seq[R]]

A SQL VALUES clause, used to treat a sequence of primitive Ts as a Select query.

A SQL VALUES clause, used to treat a sequence of primitive Ts as a Select query.

Attributes

Companion
object
Supertypes
trait Proxy[Q, R]
trait Select[Q, R]
trait Wrapped
trait DelegateQueryable[Q, Seq[R]]
trait Query[Seq[R]]
trait JoinOps[Select, Q, R]
trait Joinable[Q, R]
trait Aggregatable[Q]
trait WithSqlExpr[Q]
trait Renderable
class Object
trait Matchable
class Any
Show all
object Values

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Values.type
class WithCte[Q, R](walked: Walked, val lhs: Select[_, _], val cteRef: WithCteRef, val rhs: Select[Q, R], val withPrefix: SqlStr)(implicit val qr: Row[Q, R], val dialect: DialectTypeMappers) extends Proxy[Q, R]

A SQL WITH clause

A SQL WITH clause

Attributes

Companion
object
Supertypes
trait Proxy[Q, R]
trait Select[Q, R]
trait Wrapped
trait DelegateQueryable[Q, Seq[R]]
trait Query[Seq[R]]
trait JoinOps[Select, Q, R]
trait Joinable[Q, R]
trait Aggregatable[Q]
trait WithSqlExpr[Q]
trait Renderable
class Object
trait Matchable
class Any
Show all
object WithCte

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
WithCte.type
class WithCteRef(walked: Walked) extends From

Attributes

Supertypes
trait From
class Object
trait Matchable
class Any