easysql.dsl

package easysql.dsl

Members list

Type members

Classlikes

case class AggExpr[T <: SqlDataType](name: String, args: List[Expr[_]], distinct: Boolean, attrs: Map[String, Expr[_]], orderBy: List[OrderBy]) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class AliasExpr[T <: SqlDataType, Alias <: String](expr: Expr[T], name: Alias)

Attributes

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
AllColumn.type
case class AllColumnExpr(owner: Option[String]) extends Expr[Nothing]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[Nothing]
class Object
trait Matchable
class Any
Show all
sealed trait AnyTable

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class JoinTable
class TableSchema[E]
case class BetweenExpr(expr: Expr[_], start: Expr[_], end: Expr[_], not: Boolean) extends Expr[Boolean]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[Boolean]
class Object
trait Matchable
class Any
Show all
case class BinaryExpr[T <: SqlDataType](left: Expr[_], op: SqlBinaryOperator, right: Expr[_]) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class CaseBranch[T](expr: Expr[_], thenValue: Expr[_])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class CaseExpr[T <: SqlDataType](branches: List[CaseBranch[_]], default: Expr[_]) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class CastExpr[T <: SqlDataType](expr: Expr[_], castType: String) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class Column(columnName: String) extends StaticAnnotation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class ColumnExpr[T <: SqlDataType, N <: String](tableName: String, columnName: String, identName: N) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class CustomColumn[T, D <: SqlDataType](columnName: String, serializer: CustomSerializer[T, D]) extends StaticAnnotation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
trait CustomSerializer[T, D]

Attributes

Supertypes
class Object
trait Matchable
class Any
case class DynamicExpr[T <: SqlDataType](expr: SqlExpr) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
sealed trait Expr[T <: SqlDataType]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class AggExpr[T]
class BetweenExpr
class BinaryExpr[T]
class CaseExpr[T]
class CastExpr[T]
class ColumnExpr[T, N]
class DynamicExpr[T]
class FuncExpr[T]
class InExpr
class ListExpr[T]
class LiteralExpr[T]
object NullExpr.type
class OverExpr[T]
class PrimaryKeyExpr[T, N]
class SubQueryExpr[T]
Show all
object Expr

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Expr.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object boolOperator.type
object dateOperator.type
object stringOperator.type
object unsafeOperator.type
case class FuncExpr[T <: SqlDataType](name: String, args: List[Expr[_]]) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class InExpr(expr: Expr[_], inExpr: Expr[_], not: Boolean) extends Expr[Boolean]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[Boolean]
class Object
trait Matchable
class Any
Show all
case class IncrKey(columnName: String) extends StaticAnnotation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
class JPA[E <: Product](val table: TableSchema[E]) extends Dynamic

Attributes

Companion
object
Supertypes
trait Dynamic
class Object
trait Matchable
class Any
object JPA

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
JPA.type
case class JoinTable(left: AnyTable, joinType: SqlJoinType, right: AnyTable, onCondition: Option[Expr[Boolean]]) extends AnyTable

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AnyTable
class Object
trait Matchable
class Any
Show all
case class ListExpr[T <: SqlDataType](list: List[Expr[_]]) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class LiteralExpr[T <: SqlDataType](value: T) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case object NullExpr extends Expr[Nothing]

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Expr[Nothing]
class Object
trait Matchable
class Any
Show all
Self type
NullExpr.type
case class OrderBy(expr: Expr[_], order: SqlOrderByOption)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class OverExpr[T <: SqlDataType](func: AggExpr[T], partitionBy: List[Expr[_]], orderBy: List[OrderBy], between: Option[SqlOverBetween]) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class PrimaryKey(columnName: String) extends StaticAnnotation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class PrimaryKeyExpr[T <: SqlDataType, N <: String](tableName: String, columnName: String, identName: N, inc: Boolean) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class PrimaryKeyGenerator(columnName: String, generator: () => SqlDataType) extends StaticAnnotation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
case class SubQueryExpr[T <: SqlDataType](query: Query[(T), _]) extends Expr[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Expr[T]
class Object
trait Matchable
class Any
Show all
case class Table(tableName: String) extends StaticAnnotation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
class TableSchema[E <: Product](`__tableName`: String, `__aliasName`: Option[String], `__cols`: List[ColumnExpr[_, _]]) extends AnyTable, Selectable

Attributes

Supertypes
trait Selectable
trait AnyTable
class Object
trait Matchable
class Any
object unsafeOperator extends ExprOperator[_]

Attributes

Supertypes
trait ExprOperator[_]
class Object
trait Matchable
class Any
Self type

Types

type AliasNames[T <: Tuple] = HasAliasName[T] match { case true => ExtractAliasNames[T] case false => EmptyTuple }
type ElementType[T <: Tuple, N <: Tuple, Name <: String] = (T, N) match { case (t *: tt, n *: nt) => n == Name match { case true => t match { case SqlDataType => t case Option[o] => o match { case SqlDataType => o } case Any => Nothing } case false => ElementType[tt, nt, Name] } case (EmptyTuple, EmptyTuple) => Nothing }
type ExprType[T <: Tuple] = T match { case h *: t => Expr[h] *: ExprType[t] case EmptyTuple => EmptyTuple }
type ExtractAliasNames[T <: Tuple] = T match { case AliasExpr[_$5, n] *: t => n *: ExtractAliasNames[t] case ColumnExpr[_$6, n] *: t => n *: ExtractAliasNames[t] case PrimaryKeyExpr[_$7, n] *: t => n *: ExtractAliasNames[t] case Any => EmptyTuple }
type FindTypeByName[T <: Tuple, I <: Int, Name <: String] = I >= 0 match { case true => Elem[T, I] match { case (t, n) => n == Name match { case true => t case false => FindTypeByName[T, I - 1, Name] } case Any => Nothing } case false => Nothing }
type HasAliasName[T <: Tuple] = T match { case AliasExpr[_$2, n] *: t => true && HasAliasName[t] case ColumnExpr[_$3, n] *: t => true && HasAliasName[t] case PrimaryKeyExpr[_$4, n] *: t => true && HasAliasName[t] case EmptyTuple => true case Any => false }
type InsertType[T <: Tuple] = T match { case h *: t => h | Option[h] *: InsertType[t] case EmptyTuple => EmptyTuple }
type InverseMap[X <: Tuple] = X match { case Expr[x] *: t => x *: InverseMap[t] case AliasExpr[x, _$1] *: t => x *: InverseMap[t] case TableSchema[x] *: t => x *: InverseMap[t] case EmptyTuple => EmptyTuple }
type JPAArgsType[ElementTypes <: Tuple, ElementLabels <: Tuple, NS <: Tuple] = NS match { case h *: t => h match { case "by" | "and" | "or" => t match { case name *: tt => tt match { case "in" | "notIn" *: ttt => List[ElementType[ElementTypes, ElementLabels, name]] *: JPAArgsType[ElementTypes, ElementLabels, ttt] case "like" | "notLike" | "startingWith" | "endingWith" *: ttt => String *: JPAArgsType[ElementTypes, ElementLabels, ttt] case "gt" | "ge" | "lt" | "le" | "not" *: ttt => ElementType[ElementTypes, ElementLabels, name] *: JPAArgsType[ElementTypes, ElementLabels, ttt] case "between" | "notBetween" *: ttt => ElementType[ElementTypes, ElementLabels, name] *: ElementType[ElementTypes, ElementLabels, name] *: JPAArgsType[ElementTypes, ElementLabels, ttt] case "isNull" | "isNotNull" *: ttt => JPAArgsType[ElementTypes, ElementLabels, ttt] case Any => ElementType[ElementTypes, ElementLabels, name] *: JPAArgsType[ElementTypes, ElementLabels, tt] } } case Any => JPAArgsType[ElementTypes, ElementLabels, t] } case EmptyTuple => EmptyTuple }
type MapOption[T <: Tuple] = T match { case h *: t => Option[h] *: MapOption[t] case EmptyTuple => EmptyTuple }
type MonadicJoin[T, JT] = T match { case TableSchema[t] => (T, JT) case h *: t => Concat[h *: t, (JT)] }
type NonEmpty[T <: String] = T != ""
type ResultType[T <: Tuple] = T match { case (t) => Option[t] case Any => MapOption[T] }
type Split[S <: String, Begin <: Int, I <: Int] = I < Length[S] match { case false => EmptyTuple case true => CharAt[S, I] match { case '_' => Substring[S, Begin, I] *: Split[S, I + 1, I + 1] case Any => Split[S, Begin, I + 1] } }
type SplitUnderline[S <: String] = Split[S + "_", 0, 0]
type UnionTo[A, B] = A match { case B => B case SqlNumberType => B match { case SqlNumberType => BigDecimal } }
type UnionType[X <: Tuple, Y <: Tuple] = (X, Y) match { case (a *: at, b *: bt) => UnionTo[a, b] *: UnionType[at, bt] case (EmptyTuple, EmptyTuple) => EmptyTuple }
type UpdateType[T <: SqlDataType] = T match { case SqlNumberType => SqlNumberType case String => String case Boolean => Boolean case Date => Date | String }

Value members

Concrete methods

def all[T <: SqlDataType](query: Select[(T), _]): FuncExpr[T]
def any[T <: SqlDataType](query: Select[(T), _]): FuncExpr[T]
transparent inline def asTable[T <: Product]: Any
def avg[T <: SqlNumberType](expr: Expr[T]): AggExpr[BigDecimal]
def caseWhen[T <: SqlDataType](branches: CaseBranch[T]*): CaseExpr[T]
def cast[T <: SqlDataType](expr: Expr[_], castType: String): CastExpr[T]
def col[T <: SqlDataType](text: String): DynamicExpr[T]
def commonTable(query: AliasQuery[_, _]*): With[EmptyTuple]
def count(): AggExpr[Long]
def count(expr: Expr[_]): AggExpr[Long]
def countDistinct(expr: Expr[_]): AggExpr[Long]
def cte[T <: Tuple](withQuery: InWithQuery ?=> With[T]): With[T]
def cube(expr: Expr[_]*): FuncExpr[Nothing]
inline def delete[T <: Product](pk: SqlDataType | Tuple): Delete
def deleteFrom(table: TableSchema[_]): Delete
def denseRank(): AggExpr[Long]
def dynamicSelect(columns: Expr[_]*): Select[EmptyTuple, EmptyTuple]
def exists[T <: SqlDataType](query: Select[(T), _]): FuncExpr[Boolean]
def from[P <: Product](table: TableSchema[P]): Select[(P), EmptyTuple]
def groupingSets(expr: Expr[_] | Tuple | Unit*): FuncExpr[Nothing]
inline def insert[T <: Product](entities: T*): Insert[EmptyTuple, InsertEntity]
inline def insert[T <: Product](entityList: List[T]): Insert[EmptyTuple, InsertEntity]
def insertInto[T <: Tuple](table: TableSchema[_])(columns: T): Insert[InverseMap[T], Nothing]
def jpa[E <: Product](table: TableSchema[E]): JPA[E]
def max[T <: SqlDataType](expr: Expr[T]): AggExpr[T]
def min[T <: SqlDataType](expr: Expr[T]): AggExpr[T]
def monadicQuery[T <: Product](table: TableSchema[T]): MonadicQuery[(T), TableSchema[T]]
def notExists[T <: SqlDataType](query: Select[(T), _]): FuncExpr[Boolean]
def rank(): AggExpr[Long]
def rollup(expr: Expr[_]*): FuncExpr[Nothing]
def rowNumber(): AggExpr[Long]
inline def save[T <: Product](entity: T): Save
def select[U <: Tuple](items: U): Select[InverseMap[U], AliasNames[U]]
def select[I <: SqlDataType, E <: Expr[I]](item: E): Select[(I), AliasNames[(E)]]
def select[I <: SqlDataType, N <: String](item: AliasExpr[I, N]): Select[(I), (N)]
def select[P <: Product](table: TableSchema[P]): Select[(P), EmptyTuple]
inline def selectByPk[T <: Product](pk: SqlDataType | Tuple): Select[(T), EmptyTuple]
def some[T <: SqlDataType](query: Select[(T), _]): FuncExpr[T]
def sum[T <: SqlNumberType](expr: Expr[T]): AggExpr[BigDecimal]
def table(name: String): TableSchema[Nothing]
def truncate(table: TableSchema[_]): Truncate
def update(table: TableSchema[_]): Update
inline def update[T <: Product](entity: T, skipNone: Boolean): Update
def value[T <: SqlDataType](v: T): LiteralExpr[T]

Givens

Givens

Extensions

Extensions

extension [T <: SqlNumberType](e: CaseExpr[BigDecimal])(e: CaseExpr[BigDecimal])
infix def elseIs(value: T): CaseExpr[BigDecimal]
infix def elseIs(value: Expr[T]): CaseExpr[BigDecimal]
infix def elseIs(value: Option[T]): CaseExpr[BigDecimal]
extension [T <: SqlDataType](expr: ColumnExpr[T, _] | DynamicExpr[T])(expr: ColumnExpr[T, _] | DynamicExpr[T])
infix def to[R <: UpdateType[T]](value: R): (ColumnExpr[T, _] | DynamicExpr[T], Expr[R])
infix def toExpr[R <: UpdateType[T]](value: Expr[R]): (ColumnExpr[T, _] | DynamicExpr[T], Expr[R])
infix def toOption[R <: UpdateType[T]](value: Option[R]): (ColumnExpr[T, _] | DynamicExpr[T], Expr[_])
extension (n: Int)(n: Int)
extension (s: StringContext)(s: StringContext)
def sql(args: SqlDataType | List[SqlDataType]*): NativeSql
extension (x: BinaryExpr[Boolean])(x: BinaryExpr[Boolean])
infix def thenIs[R <: SqlNumberType](value: R): CaseBranch[BigDecimal]
infix def thenIs[R <: SqlDataType](value: R): CaseBranch[R]
infix def thenIs[R <: SqlDataType](value: Expr[R]): CaseBranch[R]

Experimental extensions

extension (s: Select[_, _])(s: Select[_, _])
def toEsDsl: String

Attributes

Experimental
true
def toMongoDsl: String

Attributes

Experimental
true