Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Dec 11, 2023
1 parent e39e4a8 commit 90c00e2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scalasql/query/src/Query.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ trait Query[R] extends Renderable {
}

object Query {

/**
* Configuration for a typical update [[Query]]
*/
trait ExecuteUpdate[R] extends scalasql.query.Query[R] {
protected def queryWalkLabels() = Nil
protected def queryWalkExprs() = Nil
protected override def queryIsSingleRow = true
protected override def queryIsExecuteUpdate = true
}

/**
* Configuration for a [[Query]] that wraps another [[Query]], delegating
* most of the abstract methods to it
*/
trait DelegateQuery[R] extends scalasql.query.Query[R] {
protected def queryDelegate: Query[_]
protected def queryWalkLabels() = queryDelegate.queryWalkLabels()
Expand All @@ -32,6 +40,9 @@ object Query {
protected override def queryIsExecuteUpdate = queryDelegate.queryIsExecuteUpdate
}

/**
* Configuration for a [[Query]] that wraps an expr [[Q]] and [[Queryable]]
*/
trait DelegateQueryable[Q, R] extends scalasql.query.Query[R] with WithSqlExpr[Q] {
protected def qr: Queryable[Q, _]
protected def queryWalkLabels() = qr.walkLabels(expr)
Expand Down

0 comments on commit 90c00e2

Please sign in to comment.