From f09aac8b0b1abc910c5be7cdb45f6608bfd4a166 Mon Sep 17 00:00:00 2001 From: dosco <832235+dosco@users.noreply.github.com> Date: Sun, 1 Jan 2023 19:32:21 -0800 Subject: [PATCH] fix: test failure --- Makefile | 5 ++--- core/internal/psql/columns.go | 7 ++++--- core/internal/qcode/fields.go | 20 ++++++++++++++++---- package.json | 2 +- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 52f448f1..0b515f97 100644 --- a/Makefile +++ b/Makefile @@ -22,11 +22,10 @@ tidy: test: @go test -v -timeout 50m -race ./... - @go test -v -timeout 50m -race -db=mysql -tags=mysql ./... + @cd core; go test -v -timeout 50m -race -db=mysql -tags=mysql ./... test-norace: - @go test -v -timeout 50m ./... - @go test -v -timeout 50m -db=mysql -tags=mysql ./... + @go test -v -timeout 50m ./... && go test -v -timeout 50m -db=mysql -tags=mysql ./... BIN_DIR := $(GOPATH)/bin WEB_BUILD_DIR := ./serv/web/build/manifest.json diff --git a/core/internal/psql/columns.go b/core/internal/psql/columns.go index 464aa852..8a3ccd4c 100644 --- a/core/internal/psql/columns.go +++ b/core/internal/psql/columns.go @@ -11,9 +11,6 @@ func (c *compilerContext) renderColumns(sel *qcode.Select) { if i != 0 { c.w.WriteString(", ") } - if f.SkipRender == qcode.SkipTypeDrop { - continue - } if f.Type == qcode.FieldTypeFunc { c.renderFuncColumn(sel, f) } else { @@ -98,6 +95,10 @@ func (c *compilerContext) renderJoinColumns(sel *qcode.Select, n int) { } i++ } + // when no columns are rendered for mysql + if c.ct == "mysql" && i == 0 { + c.w.WriteString(`NULL`) + } } func (c *compilerContext) renderUnionColumn(sel, csel *qcode.Select) { diff --git a/core/internal/qcode/fields.go b/core/internal/qcode/fields.go index 3a2ad5ea..c5776a31 100644 --- a/core/internal/qcode/fields.go +++ b/core/internal/qcode/fields.go @@ -96,6 +96,14 @@ func (co *Compiler) compileChildColumns( field.Func = fn.Func field.Args = fn.Args + if err := co.compileFieldDirectives(sel, &field, f.Directives, role); err != nil { + return err + } + + if field.SkipRender == SkipTypeDrop { + continue + } + if err := co.compileFuncArgs(sel, &field, f.Args); err != nil { return err } @@ -111,6 +119,14 @@ func (co *Compiler) compileChildColumns( return err } + if err := co.compileFieldDirectives(sel, &field, f.Directives, role); err != nil { + return err + } + + if field.SkipRender == SkipTypeDrop { + continue + } + if field.Col.Blocked { return fmt.Errorf("column: '%s.%s.%s' blocked", field.Col.Schema, @@ -119,10 +135,6 @@ func (co *Compiler) compileChildColumns( } } - if err := co.compileFieldDirectives(sel, &field, f.Directives, role); err != nil { - return err - } - sel.addField(field) } diff --git a/package.json b/package.json index b8cc5de4..6fd8bbe4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "graphjin", - "version": "2.0.17", + "version": "2.0.18", "description": "GraphJin - Build APIs in 5 minutes with GraphQL", "type": "module", "main": "./wasm/js/graphjin.js",