SqlMapping

trait SqlMapping[F[_]] extends CirceMapping[F] with SqlModule[F]

An abstract mapping that is backed by a SQL database.

Source:
SqlMapping.scala
trait SqlModule[F]
class CirceMapping[F]
class Mapping[F]
class Object
trait Matchable
class Any

Type members

Classlikes

case class AliasState(next: Int, seenTables: Set[String], tableAliases: Map[(List[String], String), String], seenColumns: Set[String], columnAliases: Map[(List[String], String), String], ownerChain: List[ColumnOwner])

State required to assign table and column aliases.

State required to assign table and column aliases.

Used when rendering an SqlQuery as a Fragment. Table aliases are assigned as needed for recursive queries. Column aliases are assigned to disambiguate collections of columns generated by subqueries and unions.

Companion:
object
Source:
SqlMapping.scala
object AliasState
Companion:
class
Source:
SqlMapping.scala
sealed trait ColumnOwner extends Product with Serializable

Trait representing an owner of an `SqlColumn

Trait representing an owner of an `SqlColumn

ColumnOwners are tables, SQL queries and subqueries, common table expressions and the like. Most, but not all have a name (SqlSelect, SqlUnion and SqlJoin being unnamed examples)

Source:
SqlMapping.scala
case class ColumnRef(table: String, column: String, codec: Codec, scalaTypeName: String, pos: SourcePos)

Name of a SQL schema column and its associated codec, Scala type an defining source position within an SqlMapping.

Name of a SQL schema column and its associated codec, Scala type an defining source position within an SqlMapping.

Columns are considered equal if their table and column names are equal.

Note that ColumnRef primarily play a role in mappings. During compilation they will be used to construct SqlColumns.

Source:
SqlMapping.scala
sealed trait FieldMappingType

Enumeration representing a kind of field mapping

Enumeration representing a kind of field mapping

Companion:
object
Source:
SqlMapping.scala
case class Join(parent: ColumnRef, child: ColumnRef)

A pair of ColumnRefs, representing a SQL join.

A pair of ColumnRefs, representing a SQL join.

Source:
SqlMapping.scala
case class LeafCursor(context: Context, focus: Any, mapped: MappedQuery, parent: Option[Cursor], env: Env) extends Cursor

Cursor positioned at a GraphQL result leaf

Cursor positioned at a GraphQL result leaf

Source:
SqlMapping.scala
final class MappedQuery(query: SqlQuery)

Represents the mapping of a GraphQL query to an SQL query

Represents the mapping of a GraphQL query to an SQL query

Companion:
object
Source:
SqlMapping.scala
Companion:
class
Source:
SqlMapping.scala
object SqlColumn
Companion:
class
Source:
SqlMapping.scala
trait SqlColumn

Trait representing an SQL column

Trait representing an SQL column

Companion:
object
Source:
SqlMapping.scala
case class SqlColumnTerm(col: SqlColumn) extends Term[Option[Unit]]

Wraps an SqlColumn as a Term which can appear in a Predicate

Wraps an SqlColumn as a Term which can appear in a Predicate

Source:
SqlMapping.scala
case class SqlCursor(context: Context, focus: Any, mapped: MappedQuery, parent: Option[Cursor], env: Env) extends Cursor

Cursor positioned at a GraphQL result non-leaf

Cursor positioned at a GraphQL result non-leaf

Source:
SqlMapping.scala

Common super type for mappings which have a programmatic discriminator, ie. interface and union mappings.

Common super type for mappings which have a programmatic discriminator, ie. interface and union mappings.

Source:
SqlMapping.scala

Discriminator for the branches of an interface/union

Discriminator for the branches of an interface/union

Source:
SqlMapping.scala
case class SqlField(fieldName: String, columnRef: ColumnRef, key: Boolean, discriminator: Boolean, hidden: Boolean, associative: Boolean)(implicit pos: SourcePos) extends SqlFieldMapping
sealed trait SqlFieldMapping extends FieldMapping
case class SqlJson(fieldName: String, columnRef: ColumnRef)(implicit pos: SourcePos) extends SqlFieldMapping
case class SqlObject(fieldName: String, joins: List[Join])(implicit pos: SourcePos) extends SqlFieldMapping
Companion:
object
Source:
SqlMapping.scala
object SqlObject
Companion:
class
Source:
SqlMapping.scala
object SqlQuery
Companion:
class
Source:
SqlMapping.scala
sealed trait SqlQuery extends ColumnOwner

Representation of a SQL query in a context

Representation of a SQL query in a context

Companion:
object
Source:
SqlMapping.scala
case class SqlRoot(fieldName: String, orootTpe: Option[Type], mutation: Mutation)(implicit pos: SourcePos) extends RootMapping
Companion:
class
Source:
SqlMapping.scala
object Table
Companion:
class
Source:
SqlMapping.scala
sealed trait Table

Representation of an SQL query result

Representation of an SQL query result

Companion:
object
Source:
SqlMapping.scala
class TableDef(name: String)
object TableExpr
Companion:
class
Source:
SqlMapping.scala
sealed trait TableExpr extends ColumnOwner

Representation of a table expression

Representation of a table expression

Companion:
object
Source:
SqlMapping.scala
case class TableName(name: String)

Inherited classlikes

case class CirceCursor(context: Context, focus: Json, parent: Option[Cursor], env: Env) extends Cursor
Inherited from:
CirceMapping
Source:
circemapping.scala
case class CirceRoot(otpe: Option[Type], fieldName: String, root: Json, mutation: Mutation)(implicit pos: SourcePos) extends RootMapping
Inherited from:
CirceMapping
Source:
circemapping.scala
object CirceRoot
Inherited from:
CirceMapping
Source:
circemapping.scala
case class CursorField[T](fieldName: String, f: Cursor => Result[T], encoder: Encoder[T], required: List[String], hidden: Boolean)(implicit pos: SourcePos) extends FieldMapping
Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
Mapping
Source:
mapping.scala
case class CursorFieldJson(fieldName: String, f: Cursor => Result[Json], encoder: Encoder[Json], required: List[String], hidden: Boolean)(implicit pos: SourcePos) extends FieldMapping
Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
Mapping
Source:
mapping.scala
case class Delegate(fieldName: String, interpreter: Mapping[F], join: (Cursor, Query) => Result[Query])(implicit pos: SourcePos) extends FieldMapping
Inherited from:
Mapping
Source:
mapping.scala
trait FieldMapping extends Product with Serializable
Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
Mapping
Source:
mapping.scala
trait LeafMapping[T] extends TypeMapping
Inherited from:
Mapping
Source:
mapping.scala
case class Mutation(run: (Query, Env) => Stream[F, Result[(Query, Env)]])

Root mappings can perform a mutation prior to constructing the result Cursor. A Mutation may perform a Unit effect and simply return the passed arguments; or it may refine the passed Query and/or Env that will be used to interpret the resulting Cursor.

Root mappings can perform a mutation prior to constructing the result Cursor. A Mutation may perform a Unit effect and simply return the passed arguments; or it may refine the passed Query and/or Env that will be used to interpret the resulting Cursor.

Inherited from:
Mapping
Source:
mapping.scala
object Mutation
Inherited from:
Mapping
Source:
mapping.scala
abstract class ObjectMapping extends TypeMapping
Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
Mapping
Source:
mapping.scala
case class PrefixedMapping(tpe: Type, mappings: List[(List[String], ObjectMapping)])(implicit pos: SourcePos) extends TypeMapping
Inherited from:
Mapping
Source:
mapping.scala
case class PrimitiveField(fieldName: String, hidden: Boolean)(implicit pos: SourcePos) extends FieldMapping
Inherited from:
Mapping
Source:
mapping.scala
case class PrimitiveMapping(tpe: Type)(implicit pos: SourcePos) extends TypeMapping
Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
Mapping
Source:
mapping.scala
trait SqlFragment[T] extends Monoid[T]

Typeclass for SQL fragments.

Typeclass for SQL fragments.

Inherited from:
SqlModule
Source:
SqlModule.scala
trait TypeMapping extends Product with Serializable
Inherited from:
Mapping
Source:
mapping.scala

Types

Inherited types

type Codec

The type of a codec that reads and writes column values of type A.

The type of a codec that reads and writes column values of type A.

Inherited from:
SqlModule
Source:
SqlModule.scala
type Encoder

The type of an encoder that writes column values of type A.

The type of an encoder that writes column values of type A.

Inherited from:
SqlModule
Source:
SqlModule.scala

The type of a fragment of SQL together with any interpolated arguments.

The type of a fragment of SQL together with any interpolated arguments.

Inherited from:
SqlModule
Source:
SqlModule.scala

Value members

Concrete methods

def columnForAtomicField(context: Context, fieldName: String): Option[SqlColumn]

Returns the aliased column corresponding to the atomic field fieldName in context

Returns the aliased column corresponding to the atomic field fieldName in context

Source:
SqlMapping.scala
def columnForSqlTerm[T](context: Context, term: Term[T]): Option[SqlColumn]

Returns the aliased columns corresponding to term in context

Returns the aliased columns corresponding to term in context

Source:
SqlMapping.scala
def columnsForLeaf(context: Context, fieldName: String): List[SqlColumn]

Returns the columns for leaf field fieldName in context

Returns the columns for leaf field fieldName in context

Source:
SqlMapping.scala

Returns the discriminator columns for the context type

Returns the discriminator columns for the context type

Source:
SqlMapping.scala

Returns the discriminator for the type at context

Returns the discriminator for the type at context

Source:
SqlMapping.scala

Returns the Encoder for the given type

Returns the Encoder for the given type

Source:
SqlMapping.scala
def encoderForTerm(context: Context, term: Term[_]): Option[Encoder]

Returns the Encoder for the given term in context

Returns the Encoder for the given term in context

Source:
SqlMapping.scala

Return an indicator of the kind of field mapping corresponding to fieldName in context

Return an indicator of the kind of field mapping corresponding to fieldName in context

Source:
SqlMapping.scala

Is the context type mapped to an associative table?

Is the context type mapped to an associative table?

Source:
SqlMapping.scala
def isComputedField(context: Context, fieldName: String): Boolean

Is fieldName in context computed?

Is fieldName in context computed?

Source:
SqlMapping.scala
def isJsonb(context: Context, fieldName: String): Boolean

Is fieldName in context Jsonb?

Is fieldName in context Jsonb?

Source:
SqlMapping.scala
def isSingular(context: Context, fieldName: String, query: Query): Boolean

Does the supplied field correspond to a single, possibly structured, value?

Does the supplied field correspond to a single, possibly structured, value?

Source:
SqlMapping.scala
def isSqlTerm(context: Context, term: Term[_]): Boolean

Is term in contextexpressible in SQL?

Is term in contextexpressible in SQL?

Source:
SqlMapping.scala

Returns the key columns for the context type

Returns the key columns for the context type

Source:
SqlMapping.scala
def mkResultPath(context: Context, fieldName: String): Option[List[String]]
def nonLeafList(context: Context, fieldName: String): Boolean

Does the type of fieldName in context represent a list of subobjects?

Does the type of fieldName in context represent a list of subobjects?

Source:
SqlMapping.scala

Returns the table for the type at context

Returns the table for the type at context

Source:
SqlMapping.scala

Inherited methods

def compileAndRun(text: String, name: Option[String], untypedVars: Option[Json], introspectionLevel: IntrospectionLevel, env: Env)(implicit sc: Compiler[F, F]): F[Json]
Inherited from:
QueryExecutor
Source:
mapping.scala
def compileAndRunAll(text: String, name: Option[String], untypedVars: Option[Json], introspectionLevel: IntrospectionLevel, env: Env): Stream[F, Json]
Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
Mapping
Source:
mapping.scala
def fetch(fragment: Fragment, codecs: List[(Boolean, Codec)]): F[Vector[Array[Any]]]
Inherited from:
SqlModule
Source:
SqlModule.scala
def fieldMapping(context: Context, fieldName: String): Option[FieldMapping]
Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
SqlModule
Source:
SqlModule.scala
Inherited from:
SqlModule
Source:
SqlModule.scala
Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
SqlModule
Source:
SqlModule.scala
Inherited from:
Mapping
Source:
mapping.scala
def rootCursor(context: Context, fieldName: String, resultName: Option[String], child: Query, env: Env): Stream[F, Result[(Query, Cursor)]]
def rootMapping(context: Context, fieldName: String): Option[RootMapping]
Inherited from:
Mapping
Source:
mapping.scala
def run(op: Operation, env: Env): Stream[F, Json]
Inherited from:
Mapping
Source:
mapping.scala
def run(query: Query, rootTpe: Type, env: Env): Stream[F, Json]
Inherited from:
Mapping
Source:
mapping.scala

Extract an encoder from a codec.

Extract an encoder from a codec.

Inherited from:
SqlModule
Source:
SqlModule.scala

Concrete fields

Inherited fields

Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
Mapping
Source:
mapping.scala

Implicits

Inherited implicits

Inherited from:
SqlModule
Source:
SqlModule.scala
implicit val M: Monad[F]
Inherited from:
Mapping
Source:
mapping.scala