Skip to content

Commit

Permalink
fix: change module prefix to /v2
Browse files Browse the repository at this point in the history
  • Loading branch information
dosco committed Dec 19, 2022
1 parent dfb96e7 commit 8db7d8b
Show file tree
Hide file tree
Showing 93 changed files with 181 additions and 188 deletions.
24 changes: 12 additions & 12 deletions core/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"database/sql"
"fmt"
"time"
"github.com/dosco/graphjin/core"
"github.com/dosco/graphjin/v2/core"
_ "github.com/jackc/pgx/v5/stdlib"
)
Expand Down Expand Up @@ -56,13 +56,13 @@ import (
"sync/atomic"
"time"

"github.com/dosco/graphjin/core/internal/allow"
"github.com/dosco/graphjin/core/internal/graph"
"github.com/dosco/graphjin/core/internal/psql"
"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/plugin"
"github.com/dosco/graphjin/plugin/fs"
"github.com/dosco/graphjin/v2/core/internal/allow"
"github.com/dosco/graphjin/v2/core/internal/graph"
"github.com/dosco/graphjin/v2/core/internal/psql"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
plugin "github.com/dosco/graphjin/v2/plugin"
"github.com/dosco/graphjin/v2/plugin/fs"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"
)
Expand Down Expand Up @@ -173,16 +173,16 @@ func newGraphJin(conf *Config, db *sql.DB, dbinfo *sdata.DBInfo, options ...Opti
return nil, err
}

if err := gj.initFS(); err != nil {
return nil, err
}

for _, op := range options {
if err := op(gj); err != nil {
return nil, err
}
}

if err := gj.initFS(); err != nil {
return nil, err
}

if err := gj.initDiscover(); err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions core/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"encoding/json"
"fmt"

"github.com/dosco/graphjin/core/internal/psql"
"github.com/dosco/graphjin/internal/jsn"
"github.com/dosco/graphjin/v2/core/internal/psql"
"github.com/dosco/graphjin/v2/internal/jsn"
)

// argList function is used to create a list of arguments to pass
Expand Down
2 changes: 1 addition & 1 deletion core/array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"encoding/json"
"fmt"

"github.com/dosco/graphjin/core"
"github.com/dosco/graphjin/v2/core"
)

func Example_queryParentAndChildrenViaArrayColumn() {
Expand Down
5 changes: 3 additions & 2 deletions core/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"sync"

"github.com/dosco/graphjin/core/internal/psql"
"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/psql"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/go-playground/validator/v10"
)

Expand Down Expand Up @@ -118,6 +118,7 @@ func (gj *graphjin) compileQueryForRole(
return st, err
}
st.qc.Validation.VE = ve
st.qc.Validation.Exists = true
}

if st.qc.Script.Name != "" {
Expand Down
2 changes: 1 addition & 1 deletion core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/qcode"
)

// Configuration for the GraphJin compiler core
Expand Down
2 changes: 1 addition & 1 deletion core/config1.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"path/filepath"

"github.com/dosco/graphjin/plugin"
"github.com/dosco/graphjin/v2/plugin"
"gopkg.in/yaml.v3"
)

Expand Down
12 changes: 6 additions & 6 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"strconv"

"github.com/avast/retry-go"
"github.com/dosco/graphjin/core/internal/psql"
"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/psql"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
"github.com/go-playground/validator/v10"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
Expand Down Expand Up @@ -266,7 +266,7 @@ func (c *gcontext) execQuery(ctx context.Context, qr queryReq, role string) (que
}
}

if qc.Script.HasRespFn() {
if qc.Script.Exists && qc.Script.HasRespFn() {
res.data, err = c.scriptCallResp(ctx, qc, res.data, res.role)
}

Expand Down Expand Up @@ -405,7 +405,7 @@ func (c *gcontext) validateAndUpdateVars(ctx context.Context, qcomp *queryComp,
}
}

if qc.Validation.HasValidator() {
if qc.Validation.Exists {
if err := qc.Validation.VE.Validate(qr.vars); err != nil {
return err
}
Expand All @@ -426,7 +426,7 @@ func (c *gcontext) validateAndUpdateVars(ctx context.Context, qcomp *queryComp,
}
}

if qc.Script.HasReqFn() {
if qc.Script.Exists && qc.Script.HasReqFn() {
v, err := c.scriptCallReq(ctx, qc, vars, qcomp.st.role.Name)
if len(v) != 0 {
qcomp.qr.vars = v
Expand Down
6 changes: 3 additions & 3 deletions core/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"os"
"testing"

"github.com/dosco/graphjin/core"
"github.com/dosco/graphjin/core/internal/allow"
"github.com/dosco/graphjin/plugin/fs"
core "github.com/dosco/graphjin/v2/core"
"github.com/dosco/graphjin/v2/core/internal/allow"
"github.com/dosco/graphjin/v2/plugin/fs"
"github.com/stretchr/testify/assert"
"golang.org/x/sync/errgroup"
)
Expand Down
4 changes: 2 additions & 2 deletions core/cue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"encoding/json"
"testing"

"github.com/dosco/graphjin/core"
"github.com/dosco/graphjin/plugin/cue"
core "github.com/dosco/graphjin/v2/core"
"github.com/dosco/graphjin/v2/plugin/cue"
)

func TestCueValidationQuerySingleIntVarValue(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/dbint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"testing"

"github.com/dosco/graphjin/core"
"github.com/dosco/graphjin/v2/core"
"github.com/orlangure/gnomock"
"github.com/orlangure/gnomock/preset/cockroachdb"
"github.com/orlangure/gnomock/preset/mssql"
Expand Down
15 changes: 4 additions & 11 deletions core/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,19 @@ import (
"strings"
"unicode"

"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/plugin/fs"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
"github.com/dosco/graphjin/v2/plugin/fs"
"github.com/gobuffalo/flect"
)

func (gj *graphjin) initFS() error {
if gj.fs != nil {
return nil
}

basePath, err := gj.basePath()
if err != nil {
return err
}

err = OptionSetFS(fs.NewOsFSWithBase(basePath))(gj)
if err != nil {
return err
}
gj.fs = fs.NewOsFSWithBase(basePath)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion core/insert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"encoding/json"
"fmt"

"github.com/dosco/graphjin/core"
"github.com/dosco/graphjin/v2/core"
)

func Example_insert() {
Expand Down
6 changes: 3 additions & 3 deletions core/internal/allow/allow.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"gopkg.in/yaml.v3"

"github.com/chirino/graphql/schema"
"github.com/dosco/graphjin/core/internal/graph"
"github.com/dosco/graphjin/internal/jsn"
"github.com/dosco/graphjin/plugin"
"github.com/dosco/graphjin/v2/core/internal/graph"
"github.com/dosco/graphjin/v2/internal/jsn"
"github.com/dosco/graphjin/v2/plugin"
lru "github.com/hashicorp/golang-lru"
)

Expand Down
2 changes: 1 addition & 1 deletion core/internal/allow/allow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package allow
import (
"testing"

"github.com/dosco/graphjin/core/internal/graph"
"github.com/dosco/graphjin/v2/core/internal/graph"
)

func TestGQLName1(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/internal/allow/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package allow
import (
"testing"

"github.com/dosco/graphjin/core/internal/graph"
"github.com/dosco/graphjin/v2/core/internal/graph"
)

func TestFuzzCrashers(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/internal/allow/gql.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"regexp"
"strings"

"github.com/dosco/graphjin/plugin"
"github.com/dosco/graphjin/v2/plugin"
)

var incRe = regexp.MustCompile(`(?m)#import \"(.+)\"`)
Expand Down
4 changes: 2 additions & 2 deletions core/internal/psql/columns.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package psql

import (
"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
)

func (c *compilerContext) renderColumns(sel *qcode.Select) {
Expand Down
6 changes: 3 additions & 3 deletions core/internal/psql/exp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package psql
import (
"strings"

"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/core/internal/util"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/util"
)

type expContext struct {
Expand Down
2 changes: 1 addition & 1 deletion core/internal/psql/fn.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package psql

import "github.com/dosco/graphjin/core/internal/qcode"
import "github.com/dosco/graphjin/v2/core/internal/qcode"

func (c *compilerContext) renderFunctionSearchRank(sel *qcode.Select, f qcode.Field) {
if c.ct == "mysql" {
Expand Down
3 changes: 2 additions & 1 deletion core/internal/psql/fuzz.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//go:build gofuzz
// +build gofuzz

package psql

import (
"encoding/json"

"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/qcode"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions core/internal/psql/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
package psql

import (
"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
)

func (c *compilerContext) renderInsert() {
Expand Down
8 changes: 4 additions & 4 deletions core/internal/psql/mutate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"bytes"
"strings"

"github.com/dosco/graphjin/core/internal/graph"
"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/core/internal/util"
"github.com/dosco/graphjin/v2/core/internal/graph"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/util"
)

func (co *Compiler) compileMutation(
Expand Down
6 changes: 3 additions & 3 deletions core/internal/psql/psql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"testing"

"github.com/dosco/graphjin/core/internal/psql"
"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/psql"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions core/internal/psql/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"encoding/json"
"fmt"

"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion core/internal/psql/recur.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package psql

import (
"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/qcode"
)

func (c *compilerContext) renderRecursiveBaseSelect(sel *qcode.Select) {
Expand Down
4 changes: 2 additions & 2 deletions core/internal/psql/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
package psql

import (
"github.com/dosco/graphjin/core/internal/qcode"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/qcode"
"github.com/dosco/graphjin/v2/core/internal/sdata"
)

func (c *compilerContext) renderUpdate() {
Expand Down
2 changes: 1 addition & 1 deletion core/internal/qcode/err.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package qcode
import (
"fmt"

"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/sdata"
)

func graphError(err error, from, to, through string) error {
Expand Down
6 changes: 3 additions & 3 deletions core/internal/qcode/exp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"errors"
"fmt"

"github.com/dosco/graphjin/core/internal/graph"
"github.com/dosco/graphjin/core/internal/sdata"
"github.com/dosco/graphjin/core/internal/util"
"github.com/dosco/graphjin/v2/core/internal/graph"
"github.com/dosco/graphjin/v2/core/internal/sdata"
"github.com/dosco/graphjin/v2/core/internal/util"
)

func (co *Compiler) compileArgObj(edge string,
Expand Down
Loading

1 comment on commit 8db7d8b

@vercel
Copy link

@vercel vercel bot commented on 8db7d8b Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.