File tree Expand file tree Collapse file tree 3 files changed +38
-10
lines changed
main/kotlin/com/github/mgramin/sqlboot
test/kotlin/com/github/mgramin/sqlboot/sql/select/wrappers Expand file tree Collapse file tree 3 files changed +38
-10
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,7 @@ import com.github.mgramin.sqlboot.model.uri.impl.DbUri
4343import com.github.mgramin.sqlboot.model.uri.impl.FakeUri
4444import com.github.mgramin.sqlboot.sql.select.SelectQuery
4545import com.github.mgramin.sqlboot.sql.select.impl.SimpleSelectQuery
46- import com.github.mgramin.sqlboot.sql.select.wrappers.JdbcSelectQuery
47- import com.github.mgramin.sqlboot.sql.select.wrappers.OrderedSelectQuery
48- import com.github.mgramin.sqlboot.sql.select.wrappers.PaginatedSelectQuery
49- import com.github.mgramin.sqlboot.sql.select.wrappers.RestSelectQuery
46+ import com.github.mgramin.sqlboot.sql.select.wrappers.*
5047import com.github.mgramin.sqlboot.template.generator.impl.GroovyTemplateGenerator
5148import com.google.gson.Gson
5249import com.google.gson.JsonArray
@@ -127,12 +124,13 @@ class SqlResourceType(
127124 private fun createQuery (uri : Uri , endpoint : Endpoint , dialect : String ): SelectQuery {
128125 val paginationQueryTemplate = dialects.first { it.name() == dialect }.paginationQueryTemplate()
129126 val baseQuery =
130- PaginatedSelectQuery (
131- OrderedSelectQuery (
132- simpleSelectQuery,
133- uri.orderedColumns()),
134- uri,
135- paginationQueryTemplate)
127+ GrafanaSelectQuery (
128+ PaginatedSelectQuery (
129+ OrderedSelectQuery (
130+ simpleSelectQuery,
131+ uri.orderedColumns()),
132+ uri,
133+ paginationQueryTemplate))
136134 return if (simpleSelectQuery.properties()[" executor" ] == " http" ) {
137135 RestSelectQuery (
138136 baseQuery,
Original file line number Diff line number Diff line change 1+ package com.github.mgramin.sqlboot.sql.select.wrappers
2+
3+ import com.github.mgramin.sqlboot.sql.select.SelectQuery
4+
5+ class GrafanaSelectQuery (
6+ private val origin : SelectQuery
7+ ) : SelectQuery {
8+
9+ override fun query () = origin.query().replace(" ${" $" } __timeFilter(time)" , " 1=1" )
10+
11+ override fun execute (variables : Map <String , Any >) = origin.execute(variables)
12+
13+ override fun properties () = origin.properties()
14+
15+ override fun columns () = origin.columns()
16+
17+ }
Original file line number Diff line number Diff line change 1+ package com.github.mgramin.sqlboot.sql.select.wrappers
2+
3+ import org.junit.jupiter.api.Test
4+
5+ import org.junit.jupiter.api.Assertions.*
6+
7+ internal class GrafanaSelectQueryTest {
8+
9+ @Test
10+ fun query () {
11+ }
12+
13+ }
You can’t perform that action at this time.
0 commit comments