Skip to content

Commit 2b01cf1

Browse files
committed
fmt
1 parent a9214c8 commit 2b01cf1

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

docs/reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4221,10 +4221,10 @@ Buyer.insert
42214221
```sql
42224222
INSERT INTO buyer (name, date_of_birth)
42234223
SELECT
4224-
buyer0.name AS res_0,
4225-
buyer0.date_of_birth AS res_1
4226-
FROM buyer buyer0
4227-
WHERE (buyer0.name <> ?)
4224+
buyer1.name AS res_0,
4225+
buyer1.date_of_birth AS res_1
4226+
FROM buyer buyer1
4227+
WHERE (buyer1.name <> ?)
42284228
RETURNING buyer.id AS res
42294229
```
42304230

scalasql/core/src/SqlStr.scala

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ object SqlStr {
3737
* parallel arrays, allowing you to render it or otherwise make use of its data.
3838
*/
3939
class Flattened(
40-
val queryParts: Array[CharSequence],
41-
val interps0: Array[Interp],
42-
isCompleteQuery: Boolean,
43-
val referencedExprs: Array[Expr.Identity]
40+
val queryParts: Array[CharSequence],
41+
val interps0: Array[Interp],
42+
isCompleteQuery: Boolean,
43+
val referencedExprs: Array[Expr.Identity]
4444
) extends SqlStr(queryParts, interps0, isCompleteQuery, referencedExprs) {
4545
def interpsIterator = interps0.iterator.map(_.asInstanceOf[Interp.TypeInterp[_]])
4646
def renderSql(castParams: Boolean) = {
@@ -95,7 +95,7 @@ object SqlStr {
9595
finalParts.addOne(lastFinalPart)
9696
}
9797
}
98-
queryParts.length match{
98+
queryParts.length match {
9999
case 0 => // do nothing
100100
case 1 =>
101101
addFinalPart(true, queryParts.head)
@@ -108,7 +108,6 @@ object SqlStr {
108108
if (parenthesize) addFinalPart(boundary, "(")
109109
boundary = true
110110

111-
112111
var i = 0
113112
val length = params.length
114113
while (i < length) {
@@ -133,7 +132,12 @@ object SqlStr {
133132
}
134133

135134
rec(self, true)
136-
new Flattened(finalParts.result(), finalInterps.result(), self.isCompleteQuery, finalExprs.result())
135+
new Flattened(
136+
finalParts.result(),
137+
finalInterps.result(),
138+
self.isCompleteQuery,
139+
finalExprs.result()
140+
)
137141
}
138142

139143
/**
@@ -161,8 +165,8 @@ object SqlStr {
161165
val finalInterps = collection.mutable.ArrayBuilder.make[Interp]
162166
val finalExprs = collection.mutable.ArrayBuilder.make[Expr.Identity]
163167
def handle(s: SqlStr) = {
164-
s.queryParts.length match{
165-
case 0 => //donothing
168+
s.queryParts.length match {
169+
case 0 => // donothing
166170
case 1 =>
167171
if (lastFinalPart == null) {
168172
lastFinalPart = new StringBuilder(s.queryParts.last.toString)
@@ -173,7 +177,7 @@ object SqlStr {
173177
if (lastFinalPart == null) {
174178
finalParts.addAll(s.queryParts, 0, s.queryParts.length - 1)
175179
lastFinalPart = new StringBuilder(s.queryParts.last.toString)
176-
}else {
180+
} else {
177181
lastFinalPart.append(s.queryParts.head)
178182
finalParts.addOne(lastFinalPart)
179183
finalParts.addAll(s.queryParts, 1, s.queryParts.length - 2)
@@ -185,7 +189,7 @@ object SqlStr {
185189
finalExprs.addAll(s.referencedExprs)
186190
}
187191
handle(first.get)
188-
while(it.hasNext){
192+
while (it.hasNext) {
189193
handle(sep)
190194
handle(it.next())
191195
}

scalasql/operations/src/ExprAggOps.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import scalasql.core.SqlStr.SqlStringSyntax
55
import scalasql.core.{Queryable, TypeMapper, Expr}
66

77
abstract class ExprAggOps[T](v: Aggregatable[Expr[T]]) {
8+
89
/** Concatenates the given values into one string using the given separator */
910
def mkString(sep: Expr[String] = null)(implicit tm: TypeMapper[T]): Expr[String]
1011
}

scalasql/query/src/CompoundSelect.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,9 @@ object CompoundSelect {
137137
// exprAliases, because the expressions in the CompoundSelect's lhsMap correspond
138138
// to those belonging to the LHS SimpleSelect, but we need the corresponding
139139
// expressions belonging to the RHS SimpleSelect `liveExprs` analysis to work
140-
val rhsInnerLiveExprs = rhsExprAliases
141-
.iterator
142-
.zipWithIndex
143-
.collect {
144-
case ((k, v), i) if innerLiveExprIndices.fold(true)(_(i)) => k
145-
}
146-
.toSet
140+
val rhsInnerLiveExprs = rhsExprAliases.iterator.zipWithIndex.collect {
141+
case ((k, v), i) if innerLiveExprIndices.fold(true)(_(i)) => k
142+
}.toSet
147143

148144
sql" ${SqlStr.raw(op.op)} ${rhsToSqlQuery.render(new LiveExprs(Some(rhsInnerLiveExprs)))}"
149145
}

0 commit comments

Comments
 (0)