SqlMapping

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

An abstract mapping that is backed by a SQL database.

trait SqlModule[F]
class CirceMapping[F]
class Mapping[F]
trait QueryExecutor[F, Json]
class Object
trait Matchable
class Any

Type members

Classlikes

case class AliasedMappings(tableAliases: List[(List[String], String, String)], columnAliases: List[(List[String], ColumnRef, ColumnRef)], seenTables: List[String], nextFresh: Int)

Data structure managing DB table and column aliases.

Data structure managing DB table and column aliases.

Aliases are scoped by the result path, which is unique in the GraphQL output even in the presence of GraphQL field alises. Table aliases apply from the given output path and below.

Column aliases are synthesized whenever an SQL union has to be nested in a subquery and hence requires a uniform set of column names. These column aliases apply from the given path and above.

Tables are only aliased if they have already been seen in an depth-first in-order traversal of the output graph. This data structure also track the seen state for tables.

AliasedMappings also maintains the bookeeping information needed to supply arbitrary fresh names. Currently these are used to name identity/predicate joins.

Companion
object
Companion
class
case class ColumnRef(table: String, column: String, codec: Codec, scalaTypeName: String)(implicit pos: SourcePos)

Name of a SQL schema column and its associated codec. Note that ColumnRefs are considered equal if their table and column names are equal.

Name of a SQL schema column and its associated codec. Note that ColumnRefs are considered equal if their table and column names are equal.

Companion
object
object ColumnRef
Companion
class
case class Join(parent: ColumnRef, child: ColumnRef)

A pair of ColumnRefs, representing a SQL join.

A pair of ColumnRefs, representing a SQL join.

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

final class MappedQuery(query: SqlQuery, val aliasedMappings: AliasedMappings)

Represents the mapping of a GraphQL query to an SQL query

Represents the mapping of a GraphQL query to an SQL query

Companion
object
object MappedQuery
Companion
class
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

Common super type for mappings which have a programmatic discriminator, ie. interface and union mappings. TODO: support SQL-native discriminators.

Common super type for mappings which have a programmatic discriminator, ie. interface and union mappings. TODO: support SQL-native discriminators.

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
Companion
class
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
object SqlObject
Companion
class
sealed trait SqlQuery

Representation of a SQL query in a context

Representation of a SQL query in a context

Companion
object
object SqlQuery
Companion
class
case class SqlRoot(fieldName: String, orootTpe: Option[Type], mutation: Mutation)(implicit pos: SourcePos) extends RootMapping
Companion
object
Companion
class
sealed trait TableExpr

Representation of a table expression

Representation of a table expression

Companion
object
object TableExpr
Companion
class

Inherited classlikes

case class CirceCursor(context: Context, focus: Json, parent: Option[Cursor], env: Env)
Inherited from
CirceMapping
case class CirceRoot(otpe: Option[Type], fieldName: String, root: Json, mutation: Mutation)(implicit pos: SourcePos)
Inherited from
CirceMapping
object CirceRoot
Inherited from
CirceMapping
object CursorField
Inherited from
Mapping
case class CursorField[T](fieldName: String, f: Cursor => Result[T], encoder: Encoder[T], required: List[String], hidden: Boolean)(implicit pos: SourcePos)
Inherited from
Mapping
case class Delegate(fieldName: String, interpreter: Mapping[F], join: (Cursor, Query) => Result[Query])(implicit pos: SourcePos)
Inherited from
Mapping
Inherited from
Mapping
trait LeafMapping[T]
Inherited from
Mapping
object LeafMapping
Inherited from
Mapping
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
object Mutation
Inherited from
Mapping
Inherited from
Mapping
Inherited from
Mapping
case class PrefixedMapping(tpe: Type, mappings: List[(List[String], ObjectMapping)])(implicit pos: SourcePos)
Inherited from
Mapping
case class PrimitiveMapping(tpe: Type)(implicit pos: SourcePos)
Inherited from
Mapping
Inherited from
Mapping
trait SqlFragment[T]

Typeclass for SQL fragments.

Typeclass for SQL fragments.

Inherited from
SqlModule
Inherited from
Mapping

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
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
type Fragment

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

Value members

Inherited methods

Inherited from
SqlModule
def compileAndRun(text: String, name: Option[String], untypedVars: Option[Json], introspectionLevel: IntrospectionLevel, env: Env)(implicit sc: Compiler[F, F]): F[Json]
Inherited from
QueryExecutor
def compileAndRunAll(text: String, name: Option[String], untypedVars: Option[Json], introspectionLevel: IntrospectionLevel, env: Env): Stream[F, Json]
Inherited from
Mapping
def compileAndRunOne(text: String, name: Option[String], untypedVars: Option[Json], introspectionLevel: IntrospectionLevel, env: Env)(implicit sc: Compiler[F, F]): F[Json]
Inherited from
Mapping
def compilerPhases: List[Phase]
Inherited from
Mapping
Inherited from
SqlModule
def fetch(fragment: Fragment, codecs: List[(Boolean, Codec)]): F[Table]
Inherited from
SqlModule
def fieldMapping(context: Context, fieldName: String): Option[FieldMapping]
Inherited from
Mapping
Inherited from
SqlModule
def leafMapping[T](tpe: Type): Option[LeafMapping[T]]
Inherited from
Mapping
Inherited from
SqlModule
def objectMapping(context: Context): Option[ObjectMapping]
Inherited from
Mapping
def rootCursor(context: Context, fieldName: String, resultName: Option[String], child: Query, env: Env): Stream[F, Result[(Query, Cursor)]]
Inherited from
Mapping
def rootMapping(context: Context, fieldName: String): Option[RootMapping]
Inherited from
Mapping
def run(op: Operation, env: Env): Stream[F, Json]
Inherited from
Mapping
def run(query: Query, rootTpe: Type, env: Env): Stream[F, Json]
Inherited from
Mapping
Inherited from
SqlModule

Extract an encoder from a codec.

Extract an encoder from a codec.

Inherited from
SqlModule
def typeMapping(tpe: Type): Option[TypeMapping]
Inherited from
Mapping

Concrete fields

Inherited fields

lazy val compiler: QueryCompiler
Inherited from
Mapping
lazy val componentElaborator: ComponentElaborator[F]
Inherited from
Mapping
val interpreter: QueryInterpreter[F]
Inherited from
Mapping
val schema: Schema
Inherited from
Mapping
val selectElaborator: SelectElaborator
Inherited from
Mapping
Inherited from
Mapping

Implicits

Inherited implicits

Inherited from
SqlModule
implicit val M: Monad[F]
Inherited from
Mapping