Skip to content

Commit

Permalink
Merge branch 'main' into feature/dope-186-upgrade-clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
jansigi committed May 3, 2024
2 parents 83104ed + 13a701a commit f0a6264
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/kotlin_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Kotlin CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Run ktlint
run: ./gradlew ktlintCheck
- name: Run tests
run: ./gradlew test
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ import ch.ergon.dope.resolvable.fromable.AliasedBucket
import ch.ergon.dope.resolvable.fromable.Bucket
import ch.ergon.dope.resolvable.fromable.UnaliasedBucket

const val ASTERISK_STRING = "*"

class AsteriskExpression : Expression {
private val asterisk = "*"
private val queryString: String

constructor(bucket: Bucket) {
queryString = when (bucket) {
is AliasedBucket -> bucket.alias
is UnaliasedBucket -> bucket.name
} + ".$asterisk"
} + ".$ASTERISK_STRING"
}

constructor() {
queryString = asterisk
queryString = ASTERISK_STRING
}

override fun toQueryString(): String = queryString
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.ergon.dope.resolvable.expression.unaliased.aggregator

import ch.ergon.dope.resolvable.expression.AsteriskExpression
import ch.ergon.dope.resolvable.expression.ASTERISK_STRING
import ch.ergon.dope.resolvable.expression.unaliased.type.Field
import ch.ergon.dope.resolvable.formatToQueryStringWithBrackets
import ch.ergon.dope.validtype.ValidType
Expand All @@ -12,7 +12,7 @@ class CountExpression(
}

class CountAsteriskExpression : AggregateExpression {
override fun toQueryString(): String = formatToQueryStringWithBrackets("COUNT", AsteriskExpression())
override fun toQueryString(): String = "COUNT($ASTERISK_STRING)"
}

fun count(field: Field<out ValidType>) = CountExpression(field)
Expand Down

0 comments on commit f0a6264

Please sign in to comment.