Skip to content

Commit

Permalink
refactor: rewrite of a few sub-systems to support faster feature deve…
Browse files Browse the repository at this point in the history
…lopment going ahead

1. rewrite of the functions handling code toward adding support for field level functions with arguments
2. added support for field level directives curretly 'skip' and 'include' supported
3. cleanup of tests towards moving most integration tests to go examples
4. several minor bug fixes
  • Loading branch information
dosco committed Dec 1, 2022
1 parent 3ccb425 commit 3059852
Show file tree
Hide file tree
Showing 32 changed files with 1,518 additions and 1,232 deletions.
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ tidy:

test:
@go test -v -timeout 50m -race ./...
@cd core; go test -v -timeout 50m -race -db=mysql -tags=mysql -run=Example_query ./...
@cd core; go test -v -timeout 50m -race -db=mysql -tags=mysql -run=Example_sub ./...
@go test -v -timeout 50m -race -db=mysql -tags=mysql ./...

test-norace:
@go test -v -timeout 50m ./...
@cd core; go test -v -timeout 50m -db=mysql -tags=mysql -run=Example_query ./...
@cd core; go test -v -timeout 50m -db=mysql -tags=mysql -run=Example_sub ./...
@go test -v -timeout 50m -db=mysql -tags=mysql ./...

BIN_DIR := $(GOPATH)/bin
WEB_BUILD_DIR := ./serv/web/build/manifest.json
Expand Down
6 changes: 1 addition & 5 deletions core/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (gj *graphjin) compileQuery(qr queryReq, role string) (*queryComp, error) {
} else {
// In production mode enforce the allow list and
// compile and cache the result else compile each time
if qc, err = gj.getQuery(qr, role, userVars); err != nil {
if qc, err = gj.getQuery(qr, role); err != nil {
return nil, err
}

Expand Down Expand Up @@ -106,10 +106,6 @@ func (gj *graphjin) compileQueryForRole(
return st, fmt.Errorf(`roles '%s' not defined in c.gj.config`, role)
}

if qr.order[0] != "" {
vm[qr.order[0]] = json.RawMessage(qr.order[1])
}

if st.qc, err = gj.qc.Compile(qr.query, vm, st.role.Name, qr.ns); err != nil {
return st, err
}
Expand Down
2 changes: 1 addition & 1 deletion core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ func readInConfig(configFile string, fs afero.Fs) (*Config, error) {
}

if v := vi.GetString("inherits"); v != "" {
return nil, fmt.Errorf("inherited config (%s) cannot itself inherit (%s)", pcf, v)
return nil, fmt.Errorf("inherited config '%s' cannot itself inherit '%s'", pcf, v)
}

vi.SetConfigFile(cf)
Expand Down
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func (gj *graphjin) saveToAllowList(qc *qcode.QCode, query, namespace string) er
}
}

return gj.allowList.Set(av, query, qc.Metadata, namespace)
return gj.allowList.Set(av, query, namespace)
}

func (gj *graphjin) spanStart(c context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
Expand Down
Loading

0 comments on commit 3059852

Please sign in to comment.