MCPcopy
hub / github.com/dosco/graphjin / TestVeryComplexQueryWithArrayColumns

Function TestVeryComplexQueryWithArrayColumns

tests/array_test.go:123–209  ·  view source on GitHub ↗

TODO: Fix: Does not work in MYSQL

(t *testing.T)

Source from the content-addressed store, hash-verified

121
122// TODO: Fix: Does not work in MYSQL
123func TestVeryComplexQueryWithArrayColumns(t *testing.T) {
124 skipCassandra(t, "array/collection columns are not seeded in the cassandra fixture")
125 skipClickHouse(t, "array/collection columns are not seeded in the fixture")
126 if dbType == "mssql" {
127 t.Skip("skipping test for mssql (JSON virtual tables and deep nesting not yet supported)")
128 }
129 if dbType == "snowflake" {
130 t.Skip("snowflake: VARIANT as JSON-virtual-table needs RelEmbedded/RenderFromEdge lateral-join compiler support (not yet implemented)")
131 }
132 if dbType == "bigquery" {
133 t.Skip("bigquery: JSON virtual tables over arrays need RelEmbedded UNNEST lowering in the dialect/simulator")
134 }
135
136 gql := `query {
137 products(
138 # returns only 1 items
139 limit: 1,
140
141 # starts from item 10, commented out for now
142 # offset: 10,
143
144 # orders the response items by highest price
145 order_by: { price: desc },
146
147 # only items with an id >= 30 and < 30 are returned
148 where: { id: { and: { greater_or_equals: 20, lt: 28 } } }) {
149 id
150 name
151 price
152 owner {
153 full_name
154 picture : avatar
155 email
156 category_counts(limit: 2, order_by: { category_id: asc }) {
157 count
158 category {
159 name
160 }
161 }
162 }
163 category(limit: 2) {
164 id
165 name
166 }
167 }
168 }`
169
170 conf := newConfig(&core.Config{DBType: dbType, DisableAllowList: true})
171 conf.Tables = append(conf.Tables, core.Table{
172 Name: "category_counts",
173 Table: "users",
174 Type: "json",
175 Columns: []core.Column{
176 {Name: "category_id", Type: "int", ForeignKey: "categories.id"},
177 {Name: "count", Type: "int"},
178 },
179 })
180 // Append array column config to existing products table or add new

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
GraphQLMethod · 0.95
skipCassandraFunction · 0.85
skipClickHouseFunction · 0.85
newConfigFunction · 0.85
stdJSONFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected