SkunkMapping

abstract class SkunkMapping[F[_]](val pool: Resource[F, Session[F]], val monitor: SkunkMonitor[F])(implicit val M: Sync[F]) extends Mapping[F] with SkunkMappingLike[F]
trait SqlModule[F]
class Mapping[F]
class Object
trait Matchable
class Any

Type members

Inherited 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.

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
object AliasState
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
object Aliased
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
case class CirceCursor(context: Context, focus: Json, parent: Option[Cursor], env: Env) extends Cursor
case class CirceField(fieldName: String, value: Json, hidden: Boolean)(implicit pos: SourcePos) extends CirceFieldMapping
sealed trait CirceFieldMapping extends FieldMapping
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)

Inherited from:
SqlMappingLike
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.

Inherited from:
SqlMappingLike
Source:
SqlMapping.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], required: List[String], hidden: Boolean)(implicit pos: SourcePos) extends CirceFieldMapping
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
object IsNullable extends IsNullable0
sealed trait IsNullable[T]
case class Join(parent: ColumnRef, child: ColumnRef)

A pair of ColumnRefs, representing a SQL join.

A pair of ColumnRefs, representing a SQL join.

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

Cursor positioned at a GraphQL result leaf

Cursor positioned at a GraphQL result leaf

Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
Mapping
Source:
mapping.scala
trait LeafMapping[T] extends TypeMapping
Inherited from:
Mapping
Source:
mapping.scala
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
sealed trait MappedQuery

Represents the mapping of a GraphQL query to an SQL query

Represents the mapping of a GraphQL query to an SQL query

Inherited from:
SqlMappingLike
Source:
SqlMapping.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
case class RootCursor(context: Context, parent: Option[Cursor], env: Env) extends AbstractCursor

Root Cursor focussed on the top level operation of a query

Root Cursor focussed on the top level operation of a query

Construction of mapping-specific cursors is handled by delegation to mkCursorForField which is typically overridden inMapping` subtypes.

Inherited from:
Mapping
Source:
mapping.scala
class RootDef
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
case class RootEffect extends FieldMapping

Root effects can perform an intial effect prior to computing the resulting Cursor and effective Query.

Root effects can perform an intial effect prior to computing the resulting Cursor and effective Query.

Convenience methods are provided to cover the cases where only one of the query or the cursor are computed, and for where the computation is one-shot or a Stream. One-shot effects are used to perform initial effectful setup for a query or to perform the effect associated with a GraphQL mutation. Stream effects are used for GraphQL subscriptions.

If only the query is computed the default root cursor for the mapping will be used. If only the cursor is computed the client query (after elaboration) is used unmodified ... in this case results of the performed effect can only be passed to the result construction stage via the environment associated with the returned cursor.

Inherited from:
Mapping
Source:
mapping.scala
object RootEffect
Inherited from:
Mapping
Source:
mapping.scala
object SqlColumn
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
trait SqlColumn

Trait representing an SQL column

Trait representing an SQL column

Inherited from:
SqlMappingLike
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

Inherited from:
SqlMappingLike
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

Inherited from:
SqlMappingLike
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.

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala

Discriminator for the branches of an interface/union

Discriminator for the branches of an interface/union

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
case class SqlField(fieldName: String, columnRef: ColumnRef, key: Boolean, discriminator: Boolean, hidden: Boolean, associative: Boolean)(implicit pos: SourcePos) extends SqlFieldMapping
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
sealed trait SqlFieldMapping extends FieldMapping
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
trait SqlFragment[T] extends Monoid[T]

Typeclass for SQL fragments.

Typeclass for SQL fragments.

Inherited from:
SqlModule
Source:
SqlModule.scala
case class SqlJson(fieldName: String, columnRef: ColumnRef)(implicit pos: SourcePos) extends SqlFieldMapping
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
case class SqlObject(fieldName: String, joins: List[Join])(implicit pos: SourcePos) extends SqlFieldMapping
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
object SqlObject
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
object SqlQuery
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
sealed trait SqlQuery extends ColumnOwner

Representation of a SQL query in a context

Representation of a SQL query in a context

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
object Table
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
sealed trait Table

Representation of an SQL query result

Representation of an SQL query result

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

Representation of a table expression

Representation of a table expression

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
case class TableName(name: String)
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
object TableName
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
trait TypeMapping extends Product with Serializable
Inherited from:
Mapping
Source:
mapping.scala

Inherited types

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
type Codec = (Codec[_], Boolean)
type Encoder = Encoder[_]

Value members

Inherited methods

def circeCursor(tpe: Type, env: Env, value: Json): Cursor
def col[T](colName: String, codec: Codec[T])(implicit tableName: TableName, typeName: TypeName[T], isNullable: IsNullable[T], pos: SourcePos): ColumnRef
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

Inherited from:
SqlMappingLike
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

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

Returns the columns for leaf field fieldName in context

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
override def defaultRootCursor(query: Query, tpe: Type, env: Env): F[Result[(Query, Cursor)]]
Definition Classes
Inherited from:
SqlMappingLike
Source:
SqlMapping.scala

Returns the discriminator columns for the context type

Returns the discriminator columns for the context type

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala

Returns the discriminator for the type at context

Returns the discriminator for the type at context

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
Inherited from:
Mapping
Source:
mapping.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

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
def fetch(fragment: Fragment, codecs: List[(Boolean, Codec)]): F[Vector[Array[Any]]]
def fieldMapping(context: Context, fieldName: String): Option[FieldMapping]
Inherited from:
Mapping
Source:
mapping.scala

Is the context type mapped to an associative table?

Is the context type mapped to an associative table?

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

Is fieldName in context computed?

Is fieldName in context computed?

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

Is fieldName in context Jsonb?

Is fieldName in context Jsonb?

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
def isLeaf(tpe: Type): Boolean

True if the supplied type is a leaf with respect to the GraphQL schema or mapping, false otherwise.

True if the supplied type is a leaf with respect to the GraphQL schema or mapping, false otherwise.

Inherited from:
Mapping
Source:
mapping.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?

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

Is term in contextexpressible in SQL?

Is term in contextexpressible in SQL?

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala

Returns the key columns for the context type

Returns the key columns for the context type

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
Inherited from:
Mapping
Source:
mapping.scala
override def mkCursorForField(parent: Cursor, fieldName: String, resultName: Option[String]): Result[Cursor]
Definition Classes
`sc₂`.asTable.flatMap[Type[Problem],LeafCursor](((`table₂`:Table)=>`sc₂`.mapped.selectAtomicField(context,fieldName,`table₂`).map[LeafCursor](((leaf:Any)=>{ valleafFocus:Any=leafmatch{ caseSome(f)if`sc₂`.tpe.variantField(fieldName).&&(fieldTpe.isNullable.unary_!)=> (`f₂`:Any) caseother=> (`other₂`:Any) } if(leafFocus.!=(FailedJoin).unary_!)scala.runtime.Scala3RunTime.assertFailed()else() SqlMappingLike.this.LeafCursor.apply(fieldContext,leafFocus,Some.apply[Cursor](parent),Env.empty) }))))(catsDataSemigroupForNonEmptyChain[Problem]) caseTuple2((Some(_:SqlObject)|Some(_:RootEffect)),sc:SqlCursor)=> `sc₃`.asTable.map[SqlCursor](((`table₃`:Table)=>{ valfocussed:Table=`sc₃`.mapped.narrow(fieldContext,`table₃`) `sc₃`.mkChild(context=fieldContext,focus=focussed) })) case_=> SqlMappingLike.this.edu$gemini$grackle$sql$SqlMappingLike$$super$mkCursorForField(parent,fieldName,resultName) } }">SqlMappingLike -> CirceMappingLike -> Mapping
Inherited from:
`sc₂`.asTable.flatMap[Type[Problem],LeafCursor](((`table₂`:Table)=>`sc₂`.mapped.selectAtomicField(context,fieldName,`table₂`).map[LeafCursor](((leaf:Any)=>{ valleafFocus:Any=leafmatch{ caseSome(f)if`sc₂`.tpe.variantField(fieldName).&&(fieldTpe.isNullable.unary_!)=> (`f₂`:Any) caseother=> (`other₂`:Any) } if(leafFocus.!=(FailedJoin).unary_!)scala.runtime.Scala3RunTime.assertFailed()else() SqlMappingLike.this.LeafCursor.apply(fieldContext,leafFocus,Some.apply[Cursor](parent),Env.empty) }))))(catsDataSemigroupForNonEmptyChain[Problem]) caseTuple2((Some(_:SqlObject)|Some(_:RootEffect)),sc:SqlCursor)=> `sc₃`.asTable.map[SqlCursor](((`table₃`:Table)=>{ valfocussed:Table=`sc₃`.mapped.narrow(fieldContext,`table₃`) `sc₃`.mkChild(context=fieldContext,focus=focussed) })) case_=> SqlMappingLike.this.edu$gemini$grackle$sql$SqlMappingLike$$super$mkCursorForField(parent,fieldName,resultName) } }">SqlMappingLike
Source:
SqlMapping.scala
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?

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

Returns the table for the type at context

Returns the table for the type at context

Inherited from:
SqlMappingLike
Source:
SqlMapping.scala
def rootEffect(context: Context, fieldName: String): Option[RootEffect]

Yields the RootEffect, if any, associated with fieldName.

Yields the RootEffect, if any, associated with fieldName.

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
def stripCompiled(query: Query, context: Context): Query

Operators which can be compiled to SQL are eliminated here, partly to avoid duplicating work programmatically, but also because the operation isn't necessarily idempotent and the result set doesn't necessarily contain the fields required for the filter predicates.

Operators which can be compiled to SQL are eliminated here, partly to avoid duplicating work programmatically, but also because the operation isn't necessarily idempotent and the result set doesn't necessarily contain the fields required for the filter predicates.

Inherited from:
if(`context₂`.tpe.underlying.hasField(countName))Select.apply(countName,Nil,Empty)elseEmpty caseGroup(queries)=> Group.apply(queries.map[Query](((q:Query)=>loop(q,`context₂`))).filterNot(((_$20:Query)=>_$20.==(Empty)))) caseu:Unique=> u.copy(child=loop(u.child,`context₂`.asType(`context₂`.tpe.list))) casee:Environment=> { valchild$3:Query=loop(e.child,`context₂`) valenv$1:Env@uncheckedVariance=e.copy$default$1 e.copy(env$1,child=child$3) } casew:Wrap=> { valchild$4:Query=loop(w.child,`context₂`) valname$2:String@uncheckedVariance=w.copy$default$1 w.copy(name$2,child=child$4) } caser:Rename=> { valchild$5:Query=loop(r.child,`context₂`) valname$3:String@uncheckedVariance=r.copy$default$1 r.copy(name$3,child=child$5) } caset:TransformCursor=> { valchild$6:Query=loop(t.child,`context₂`) valf$1:Function1[Cursor,Result[Cursor]]@uncheckedVariance=t.copy$default$1 t.copy(f$1,child=child$6) } caseu:UntypedNarrow=> { valchild$7:Query=loop(`u₂`.child,`context₂`) valtpnme$1:String@uncheckedVariance=`u₂`.copy$default$1 `u₂`.copy(tpnme$1,child=child$7) } casen@Narrow(subtpe,_)=> { valchild$8:Query=loop(n.child,`context₂`.asType(subtpe)) valsubtpe$1:TypeRef@uncheckedVariance=n.copy$default$1 n.copy(subtpe$1,child=child$8) } cases:Skip=> { valchild$9:Query=loop(`s₂`.child,`context₂`) valsense$1:Boolean@uncheckedVariance=`s₂`.copy$default$1 valcond$1:Value@uncheckedVariance=`s₂`.copy$default$2 `s₂`.copy(sense$1,cond$1,child=child$9) } caseother@(_:Component[_>:Nothing<:[_$3>:Nothing<:Any]=>Any]|_:Defer|Empty|_:Introspect|_:Select|Skipped)=> (other:Empty|Introspect|Select|Component[_>:Nothing<:[_$3>:Nothing<:Any]=>Any]|Defer|Skipped) } loop(query,context) }">SqlMappingLike
Source:
SqlMapping.scala

Concrete fields

Inherited fields

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

Implicits

Implicits

implicit val M: Sync[F]

Inherited implicits