-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOPE-271: added new returnable interface, restructured selectable int…
…erfaces and aggregate functions
- Loading branch information
1 parent
2e76c9f
commit 2c054ca
Showing
46 changed files
with
252 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 4 additions & 8 deletions
12
core/src/main/kotlin/ch/ergon/dope/resolvable/expression/Expression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
package ch.ergon.dope.resolvable.expression | ||
|
||
import ch.ergon.dope.resolvable.Resolvable | ||
import ch.ergon.dope.resolvable.fromable.SingleReturnable | ||
import ch.ergon.dope.resolvable.fromable.RawSelectable | ||
import ch.ergon.dope.resolvable.fromable.Returnable | ||
import ch.ergon.dope.validtype.ValidType | ||
|
||
interface Expression : Resolvable | ||
interface SingleExpression<T : ValidType> : RawSelectable<T>, Returnable | ||
|
||
interface SingleExpression<T : ValidType> : Expression | ||
|
||
interface UnaliasedExpression<T : ValidType> : SingleExpression<T> | ||
|
||
interface TypeExpression<T : ValidType> : UnaliasedExpression<T>, SingleReturnable | ||
interface TypeExpression<T : ValidType> : SingleExpression<T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...in/ch/ergon/dope/resolvable/expression/unaliased/aggregator/AliasedAggregateExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.aggregator | ||
|
||
import ch.ergon.dope.DopeQuery | ||
import ch.ergon.dope.DopeQueryManager | ||
import ch.ergon.dope.resolvable.formatToQueryStringWithSymbol | ||
import ch.ergon.dope.resolvable.fromable.RawSelectable | ||
import ch.ergon.dope.validtype.ValidType | ||
|
||
class AliasedAggregateExpression<T : ValidType>( | ||
private val aggregateExpression: AggregateExpression<T>, | ||
private val alias: String, | ||
) : RawSelectable<T> { | ||
override fun toDopeQuery(manager: DopeQueryManager): DopeQuery { | ||
val aggregateExpressionDopeQuery = aggregateExpression.toDopeQuery(manager) | ||
return DopeQuery( | ||
queryString = formatToQueryStringWithSymbol( | ||
aggregateExpressionDopeQuery.queryString, | ||
"AS", | ||
"`$alias`", | ||
), | ||
parameters = aggregateExpressionDopeQuery.parameters, | ||
) | ||
} | ||
} | ||
|
||
fun <T : ValidType> AggregateExpression<T>.alias(alias: String) = AliasedAggregateExpression(this, alias) |
Oops, something went wrong.