Merge pull request #42 from go-jet/develop

Add support for go.mod (v2.4.0)
This commit is contained in:
go-jet 2020-06-28 11:27:41 +02:00 committed by GitHub
commit fdde2ab9b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
104 changed files with 275 additions and 231 deletions

View file

@ -4,15 +4,15 @@
[![codecov](https://codecov.io/gh/go-jet/jet/branch/master/graph/badge.svg)](https://codecov.io/gh/go-jet/jet) [![codecov](https://codecov.io/gh/go-jet/jet/branch/master/graph/badge.svg)](https://codecov.io/gh/go-jet/jet)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-jet/jet)](https://goreportcard.com/report/github.com/go-jet/jet) [![Go Report Card](https://goreportcard.com/badge/github.com/go-jet/jet)](https://goreportcard.com/report/github.com/go-jet/jet)
[![Documentation](https://godoc.org/github.com/go-jet/jet?status.svg)](http://godoc.org/github.com/go-jet/jet) [![Documentation](https://godoc.org/github.com/go-jet/jet?status.svg)](http://godoc.org/github.com/go-jet/jet)
[![GitHub release](https://img.shields.io/github/release/go-jet/jet.svg)](https://github.com/go-jet/jet/releases) [![GitHub release](https://img.shields.io/github/release/go-jet/jet.svg)](https://github.com/go-jet/jet/v2/releases)
[![Gitter](https://badges.gitter.im/go-jet/community.svg)](https://gitter.im/go-jet/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Gitter](https://badges.gitter.im/go-jet/community.svg)](https://gitter.im/go-jet/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Jet is a framework for writing type-safe SQL queries in Go, with ability to easily Jet is a complete solution for efficient and high performance database access, consisting of type-safe SQL builder
convert database query result into desired arbitrary object structure. with code generation and automatic query result data mapping.
Jet currently supports `PostgreSQL`, `MySQL` and `MariaDB`. Future releases will add support for additional databases. Jet currently supports `PostgreSQL`, `MySQL` and `MariaDB`. Future releases will add support for additional databases.
![jet](https://github.com/go-jet/jet/wiki/image/jet.png) ![jet](https://github.com/go-jet/jet/wiki/image/jet.png)
Jet is the easiest and the fastest way to write complex SQL queries and map database query result Jet is the easiest and the fastest way to write complex type-safe SQL queries as a Go code and map database query result
into complex object composition. __It is not an ORM.__ into complex object composition. __It is not an ORM.__
## Motivation ## Motivation
@ -58,11 +58,17 @@ https://medium.com/@go.jet/jet-5f3667efa0cc
To install Jet package, you need to install Go and set your Go workspace first. To install Jet package, you need to install Go and set your Go workspace first.
[Go](https://golang.org/) **version 1.8+ is required** [Go](https://golang.org/) **version 1.9+ is required**
### Installation ### Installation
Use the bellow command to install jet Use the bellow command to add jet as a dependency into `go.mod` project:
```sh
$ go get -u github.com/go-jet/jet/v2
```
Use the bellow command to add jet as a dependency into `GOPATH` project:
```sh ```sh
$ go get -u github.com/go-jet/jet $ go get -u github.com/go-jet/jet
``` ```
@ -70,10 +76,10 @@ $ go get -u github.com/go-jet/jet
Install jet generator to GOPATH bin folder. This will allow generating jet files from the command line. Install jet generator to GOPATH bin folder. This will allow generating jet files from the command line.
```sh ```sh
go install github.com/go-jet/jet/cmd/jet cd $GOPATH/src/ && GO111MODULE=off go get -u github.com/go-jet/jet/cmd/jet
``` ```
Make sure GOPATH bin folder is added to the PATH environment variable. *Make sure GOPATH bin folder is added to the PATH environment variable.*
### Quick Start ### Quick Start
For this quick start example we will use PostgreSQL sample _'dvd rental'_ database. Full database dump can be found in [./tests/testdata/init/postgres/dvds.sql](./tests/testdata/init/postgres/dvds.sql). For this quick start example we will use PostgreSQL sample _'dvd rental'_ database. Full database dump can be found in [./tests/testdata/init/postgres/dvds.sql](./tests/testdata/init/postgres/dvds.sql).
@ -85,7 +91,7 @@ connection parameters and root destination folder path for generated files.\
Assuming we are running local postgres database, with user `jetuser`, user password `jetpass`, database `jetdb` and Assuming we are running local postgres database, with user `jetuser`, user password `jetpass`, database `jetdb` and
schema `dvds` we will use this command: schema `dvds` we will use this command:
```sh ```sh
jet -source=PostgreSQL -host=localhost -port=5432 -user=jetuser -password=jetpass -dbname=jetdb -schema=dvds -path=./gen jet -source=PostgreSQL -host=localhost -port=5432 -user=jetuser -password=jetpass -dbname=jetdb -schema=dvds -path=./.gen
``` ```
```sh ```sh
Connecting to postgres database: host=localhost port=5432 user=jetuser password=jetpass dbname=jetdb sslmode=disable Connecting to postgres database: host=localhost port=5432 user=jetuser password=jetpass dbname=jetdb sslmode=disable
@ -144,10 +150,10 @@ First we need to import jet and generated files from previous step:
import ( import (
// dot import so go code would resemble as much as native SQL // dot import so go code would resemble as much as native SQL
// dot import is not mandatory // dot import is not mandatory
. "github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/table" . "github.com/go-jet/jet/v2/examples/quick-start/.gen/jetdb/dvds/table"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/examples/quick-start/gen/jetdb/dvds/model" "github.com/go-jet/jet/v2/examples/quick-start/gen/jetdb/dvds/model"
) )
``` ```
Lets say we want to retrieve the list of all _actors_ that acted in _films_ longer than 180 minutes, _film language_ is 'English' Lets say we want to retrieve the list of all _actors_ that acted in _films_ longer than 180 minutes, _film language_ is 'English'

View file

@ -3,10 +3,10 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
mysqlgen "github.com/go-jet/jet/generator/mysql" mysqlgen "github.com/go-jet/jet/v2/generator/mysql"
postgresgen "github.com/go-jet/jet/generator/postgres" postgresgen "github.com/go-jet/jet/v2/generator/postgres"
"github.com/go-jet/jet/mysql" "github.com/go-jet/jet/v2/mysql"
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq" _ "github.com/lib/pq"
"os" "os"

13
doc.go
View file

@ -6,13 +6,16 @@ result into desired arbitrary object structure.
Installation Installation
Use the bellow command to install jet Use the bellow command to add jet as a dependency into go.mod project:
$ go get github.com/go-jet/jet/v2
Use the bellow command to add jet as a dependency into GOPATH project:
$ go get -u github.com/go-jet/jet $ go get -u github.com/go-jet/jet
Install jet generator to GOPATH bin folder. This will allow generating jet files from the command line. Install jet generator to GOPATH bin folder. This will allow generating jet files from the command line.
go install github.com/go-jet/jet/cmd/jet cd $GOPATH/src/ && GO111MODULE=off go get -u github.com/go-jet/jet/cmd/jet
*Make sure GOPATH bin folder is added to the PATH environment variable. Make sure GOPATH bin folder is added to the PATH environment variable.
Usage Usage
@ -26,10 +29,10 @@ Then next step is to import generated SQL Builder and Model files and write SQL
import "some_path/.gen/jetdb/dvds/model" import "some_path/.gen/jetdb/dvds/model"
To write SQL queries for PostgreSQL import: To write SQL queries for PostgreSQL import:
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
To write SQL queries for MySQL and MariaDB import: To write SQL queries for MySQL and MariaDB import:
. "github.com/go-jet/jet/mysql" . "github.com/go-jet/jet/v2/mysql"
*Dot import is used so that Go code resemble as much as native SQL. Dot import is not mandatory. *Dot import is used so that Go code resemble as much as native SQL. Dot import is not mandatory.
Write SQL: Write SQL:

View file

@ -7,7 +7,7 @@
package enum package enum
import "github.com/go-jet/jet/postgres" import "github.com/go-jet/jet/v2/postgres"
var MpaaRating = &struct { var MpaaRating = &struct {
G postgres.StringExpression G postgres.StringExpression

View file

@ -8,7 +8,7 @@
package table package table
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var Actor = newActorTable() var Actor = newActorTable()

View file

@ -8,7 +8,7 @@
package table package table
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var Category = newCategoryTable() var Category = newCategoryTable()

View file

@ -8,7 +8,7 @@
package table package table
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var Film = newFilmTable() var Film = newFilmTable()

View file

@ -8,7 +8,7 @@
package table package table
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var FilmActor = newFilmActorTable() var FilmActor = newFilmActorTable()

View file

@ -8,7 +8,7 @@
package table package table
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var FilmCategory = newFilmCategoryTable() var FilmCategory = newFilmCategoryTable()

View file

@ -8,7 +8,7 @@
package table package table
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var Language = newLanguageTable() var Language = newLanguageTable()

View file

@ -8,7 +8,7 @@
package view package view
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var ActorInfo = newActorInfoTable() var ActorInfo = newActorInfoTable()

View file

@ -8,7 +8,7 @@
package view package view
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var CustomerList = newCustomerListTable() var CustomerList = newCustomerListTable()

View file

@ -9,4 +9,4 @@ Jet generated files of interest are in `./gen` folder.
with a difference of redirecting json output to files(`dest.json` and `dest2.json`) rather then to a with a difference of redirecting json output to files(`dest.json` and `dest2.json`) rather then to a
standard output. standard output.
`./gen`, `dest.json` and `dest2.json` - added to git for presentation purposes. `./gen`, `dest.json` and `dest2.json` - added into git for presentation purposes.

View file

@ -9,10 +9,10 @@ import (
// dot import so that jet go code would resemble as much as native SQL // dot import so that jet go code would resemble as much as native SQL
// dot import is not mandatory // dot import is not mandatory
. "github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/table" . "github.com/go-jet/jet/v2/examples/quick-start/.gen/jetdb/dvds/table"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/model" "github.com/go-jet/jet/v2/examples/quick-start/.gen/jetdb/dvds/model"
) )
const ( const (

View file

@ -3,7 +3,7 @@ package metadata
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"strings" "strings"
) )

View file

@ -3,7 +3,7 @@ package metadata
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
) )
// SchemaMetaData struct // SchemaMetaData struct

View file

@ -2,7 +2,7 @@ package metadata
import ( import (
"database/sql" "database/sql"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"strings" "strings"
) )

View file

@ -3,9 +3,9 @@ package template
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/go-jet/jet/generator/internal/metadata" "github.com/go-jet/jet/v2/generator/internal/metadata"
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"path/filepath" "path/filepath"
"text/template" "text/template"
) )

View file

@ -20,7 +20,7 @@ var tableSQLBuilderTemplate = `
package {{param "package"}} package {{param "package"}}
import ( import (
"github.com/go-jet/jet/{{dialect.PackageName}}" "github.com/go-jet/jet/v2/{{dialect.PackageName}}"
) )
var {{ToGoIdentifier .Name}} = new{{.GoStructName}}() var {{ToGoIdentifier .Name}} = new{{.GoStructName}}()
@ -77,7 +77,7 @@ var tablePostgreSQLBuilderTemplate = `
package {{param "package"}} package {{param "package"}}
import ( import (
"github.com/go-jet/jet/{{dialect.PackageName}}" "github.com/go-jet/jet/v2/{{dialect.PackageName}}"
) )
var {{ToGoIdentifier .Name}} = new{{.GoStructName}}() var {{ToGoIdentifier .Name}} = new{{.GoStructName}}()
@ -158,7 +158,7 @@ type {{ToGoIdentifier .Name}} struct {
` `
var enumSQLBuilderTemplate = `package enum var enumSQLBuilderTemplate = `package enum
import "github.com/go-jet/jet/{{dialect.PackageName}}" import "github.com/go-jet/jet/v2/{{dialect.PackageName}}"
var {{ToGoIdentifier $.Name}} = &struct { var {{ToGoIdentifier $.Name}} = &struct {
{{- range $index, $element := .Values}} {{- range $index, $element := .Values}}

View file

@ -3,10 +3,10 @@ package mysql
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"github.com/go-jet/jet/generator/internal/metadata" "github.com/go-jet/jet/v2/generator/internal/metadata"
"github.com/go-jet/jet/generator/internal/template" "github.com/go-jet/jet/v2/generator/internal/template"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"github.com/go-jet/jet/mysql" "github.com/go-jet/jet/v2/mysql"
"path" "path"
) )

View file

@ -2,8 +2,8 @@ package mysql
import ( import (
"database/sql" "database/sql"
"github.com/go-jet/jet/generator/internal/metadata" "github.com/go-jet/jet/v2/generator/internal/metadata"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"strings" "strings"
) )

View file

@ -3,10 +3,10 @@ package postgres
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"github.com/go-jet/jet/generator/internal/metadata" "github.com/go-jet/jet/v2/generator/internal/metadata"
"github.com/go-jet/jet/generator/internal/template" "github.com/go-jet/jet/v2/generator/internal/template"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
"path" "path"
"strconv" "strconv"
) )

View file

@ -2,8 +2,8 @@ package postgres
import ( import (
"database/sql" "database/sql"
"github.com/go-jet/jet/generator/internal/metadata" "github.com/go-jet/jet/v2/generator/internal/metadata"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
) )
// postgresQuerySet is dialect query set for PostgreSQL // postgresQuerySet is dialect query set for PostgreSQL

12
go.mod Normal file
View file

@ -0,0 +1,12 @@
module github.com/go-jet/jet/v2
go 1.11
require (
github.com/go-sql-driver/mysql v1.5.0
github.com/google/go-cmp v0.5.0
github.com/google/uuid v1.1.1
github.com/lib/pq v1.7.0
github.com/pkg/profile v1.5.0
github.com/stretchr/testify v1.6.1
)

23
go.sum Normal file
View file

@ -0,0 +1,23 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-jet/jet v1.0.0 h1:ENxUe/6lH82qLykIGAdZIlskZrpTeNfxjHz4VHtkVmA=
github.com/go-jet/jet v2.3.0+incompatible h1:Yg7JSERDC0f9x3dHUBMA2cxe9/qC6qlozDDO/s38USU=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY=
github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/pkg/profile v1.5.0 h1:042Buzk+NhDI+DeSAA62RwJL8VAuZUMQZUjCsRz1Mug=
github.com/pkg/profile v1.5.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View file

@ -1,7 +1,7 @@
package jet package jet
import ( import (
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
) )
// Clause interface // Clause interface

View file

@ -23,7 +23,7 @@ type Expression interface {
// ASC expression will be used to sort query result in ascending order // ASC expression will be used to sort query result in ascending order
ASC() OrderByClause ASC() OrderByClause
// DESC expression will be used to sort query result in ascending order // DESC expression will be used to sort query result in descending order
DESC() OrderByClause DESC() OrderByClause
} }
@ -66,7 +66,7 @@ func (e *ExpressionInterfaceImpl) ASC() OrderByClause {
return newOrderByClause(e.Parent, true) return newOrderByClause(e.Parent, true)
} }
// DESC expression will be used to sort query result in ascending order // DESC expression will be used to sort query result in descending order
func (e *ExpressionInterfaceImpl) DESC() OrderByClause { func (e *ExpressionInterfaceImpl) DESC() OrderByClause {
return newOrderByClause(e.Parent, false) return newOrderByClause(e.Parent, false)
} }

View file

@ -3,8 +3,8 @@ package jet
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/go-jet/jet/internal/3rdparty/pq" "github.com/go-jet/jet/v2/internal/3rdparty/pq"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"github.com/google/uuid" "github.com/google/uuid"
"reflect" "reflect"
"strconv" "strconv"

View file

@ -3,7 +3,7 @@ package jet
import ( import (
"context" "context"
"database/sql" "database/sql"
"github.com/go-jet/jet/qrm" "github.com/go-jet/jet/v2/qrm"
) )
//Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK) //Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)

View file

@ -1,7 +1,7 @@
package jet package jet
import ( import (
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
) )
// SerializerTable interface // SerializerTable interface

View file

@ -1,7 +1,7 @@
package jet package jet
import ( import (
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"reflect" "reflect"
) )

View file

@ -4,9 +4,9 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"github.com/go-jet/jet/qrm" "github.com/go-jet/jet/v2/qrm"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"io/ioutil" "io/ioutil"
@ -40,8 +40,8 @@ func AssertExecErr(t *testing.T, stmt jet.Statement, db qrm.DB, errorStr string)
} }
func getFullPath(relativePath string) string { func getFullPath(relativePath string) string {
goPath := os.Getenv("GOPATH") path, _ := os.Getwd()
return filepath.Join(goPath, "src/github.com/go-jet/jet/tests", relativePath) return filepath.Join(path, "../", relativePath)
} }
// PrintJson print v as json // PrintJson print v as json

View file

@ -1,7 +1,7 @@
package testutils package testutils
import ( import (
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"strings" "strings"
"time" "time"
) )

View file

@ -3,7 +3,7 @@ package utils
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"github.com/go-jet/jet/internal/3rdparty/snaker" "github.com/go-jet/jet/v2/internal/3rdparty/snaker"
"go/format" "go/format"
"os" "os"
"path/filepath" "path/filepath"

View file

@ -1,7 +1,7 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"strconv" "strconv"
) )

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// Column is common column interface for all types of columns. // Column is common column interface for all types of columns.
type Column = jet.ColumnExpression type Column = jet.ColumnExpression

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// DeleteStatement is interface for MySQL DELETE statement // DeleteStatement is interface for MySQL DELETE statement
type DeleteStatement interface { type DeleteStatement interface {

View file

@ -1,7 +1,7 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
) )
// Dialect is implementation of MySQL dialect for SQL Builder serialisation. // Dialect is implementation of MySQL dialect for SQL Builder serialisation.

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// Expression is common interface for all expressions. // Expression is common interface for all expressions.
// Can be Bool, Int, Float, String, Date, Time, Timez, Timestamp or Timestampz expressions. // Can be Bool, Int, Float, String, Date, Time, Timez, Timestamp or Timestampz expressions.

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// ROW is construct one table row from list of expressions. // ROW is construct one table row from list of expressions.
var ROW = jet.ROW var ROW = jet.ROW

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// InsertStatement is interface for SQL INSERT statements // InsertStatement is interface for SQL INSERT statements
type InsertStatement interface { type InsertStatement interface {

View file

@ -5,8 +5,8 @@ import (
"regexp" "regexp"
"time" "time"
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
) )
type unitType string type unitType string

View file

@ -1,7 +1,7 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"time" "time"
) )

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// LockStatement is interface for MySQL LOCK tables // LockStatement is interface for MySQL LOCK tables
type LockStatement interface { type LockStatement interface {

View file

@ -1,7 +1,7 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
) )
// RowLock is interface for SELECT statement row lock types // RowLock is interface for SELECT statement row lock types

View file

@ -1,7 +1,7 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
"testing" "testing"
) )

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// SelectTable is interface for MySQL sub-queries // SelectTable is interface for MySQL sub-queries
type SelectTable interface { type SelectTable interface {

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// UNION effectively appends the result of sub-queries(select statements) into single query. // UNION effectively appends the result of sub-queries(select statements) into single query.
// It eliminates duplicate rows from its result. // It eliminates duplicate rows from its result.

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// Table is interface for MySQL tables // Table is interface for MySQL tables
type Table interface { type Table interface {

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK) // Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
type Statement = jet.Statement type Statement = jet.Statement

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// UpdateStatement is interface of SQL UPDATE statement // UpdateStatement is interface of SQL UPDATE statement
type UpdateStatement interface { type UpdateStatement interface {

View file

@ -1,8 +1,8 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
"testing" "testing"
) )

View file

@ -1,6 +1,6 @@
package mysql package mysql
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// CommonTableExpression contains information about a CTE. // CommonTableExpression contains information about a CTE.
type CommonTableExpression struct { type CommonTableExpression struct {

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
) )
type cast interface { type cast interface {

View file

@ -1,7 +1,7 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
) )
type clauseReturning struct { type clauseReturning struct {

View file

@ -1,7 +1,7 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
) )
// Column is common column interface for all types of columns. // Column is common column interface for all types of columns.

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
type conflictAction interface { type conflictAction interface {
jet.Serializer jet.Serializer

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// DeleteStatement is interface for PostgreSQL DELETE statement // DeleteStatement is interface for PostgreSQL DELETE statement
type DeleteStatement interface { type DeleteStatement interface {

View file

@ -1,7 +1,7 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"strconv" "strconv"
) )

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// Expression is common interface for all expressions. // Expression is common interface for all expressions.
// Can be Bool, Int, Float, String, Date, Time, Timez, Timestamp or Timestampz expressions. // Can be Bool, Int, Float, String, Date, Time, Timez, Timestamp or Timestampz expressions.

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// ROW is construct one table row from list of expressions. // ROW is construct one table row from list of expressions.
var ROW = jet.ROW var ROW = jet.ROW

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// InsertStatement is interface for SQL INSERT statements // InsertStatement is interface for SQL INSERT statements
type InsertStatement interface { type InsertStatement interface {

View file

@ -1,7 +1,7 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
"time" "time"

View file

@ -2,8 +2,8 @@ package postgres
import ( import (
"fmt" "fmt"
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"strconv" "strconv"
"strings" "strings"
"time" "time"

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
const ( const (
// DEFAULT is jet equivalent of SQL DEFAULT // DEFAULT is jet equivalent of SQL DEFAULT

View file

@ -1,7 +1,7 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"time" "time"
) )

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// TableLockMode is a type of possible SQL table lock // TableLockMode is a type of possible SQL table lock
type TableLockMode string type TableLockMode string

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// NOT returns negation of bool expression result // NOT returns negation of bool expression result
var NOT = jet.NOT var NOT = jet.NOT

View file

@ -1,7 +1,7 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"math" "math"
) )

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// SelectTable is interface for MySQL sub-queries // SelectTable is interface for MySQL sub-queries
type SelectTable interface { type SelectTable interface {

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// UNION effectively appends the result of sub-queries(select statements) into single query. // UNION effectively appends the result of sub-queries(select statements) into single query.
// It eliminates duplicate rows from its result. // It eliminates duplicate rows from its result.

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// Table is interface for MySQL tables // Table is interface for MySQL tables
type Table interface { type Table interface {

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK) // Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
type Statement = jet.Statement type Statement = jet.Statement

View file

@ -1,7 +1,7 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
) )
// UpdateStatement is interface of SQL UPDATE statement // UpdateStatement is interface of SQL UPDATE statement

View file

@ -3,8 +3,8 @@ package postgres
import ( import (
"testing" "testing"
"github.com/go-jet/jet/internal/jet" "github.com/go-jet/jet/v2/internal/jet"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
) )
var table1Col1 = IntegerColumn("col1") var table1Col1 = IntegerColumn("col1")

View file

@ -1,6 +1,6 @@
package postgres package postgres
import "github.com/go-jet/jet/internal/jet" import "github.com/go-jet/jet/v2/internal/jet"
// CommonTableExpression contains information about a CTE. // CommonTableExpression contains information about a CTE.
type CommonTableExpression struct { type CommonTableExpression struct {

View file

@ -3,7 +3,7 @@ package qrm
import ( import (
"context" "context"
"errors" "errors"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"reflect" "reflect"
) )

View file

@ -4,7 +4,7 @@ import (
"database/sql" "database/sql"
"database/sql/driver" "database/sql/driver"
"fmt" "fmt"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"reflect" "reflect"
"strings" "strings"
) )

View file

@ -3,8 +3,8 @@ package qrm
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"github.com/go-jet/jet/qrm/internal" "github.com/go-jet/jet/v2/qrm/internal"
"github.com/google/uuid" "github.com/google/uuid"
"reflect" "reflect"
"strings" "strings"

View file

@ -4,10 +4,10 @@ import (
"database/sql" "database/sql"
"flag" "flag"
"fmt" "fmt"
"github.com/go-jet/jet/generator/mysql" "github.com/go-jet/jet/v2/generator/mysql"
"github.com/go-jet/jet/generator/postgres" "github.com/go-jet/jet/v2/generator/postgres"
"github.com/go-jet/jet/internal/utils" "github.com/go-jet/jet/v2/internal/utils"
"github.com/go-jet/jet/tests/dbconfig" "github.com/go-jet/jet/v2/tests/dbconfig"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq" _ "github.com/lib/pq"
"io/ioutil" "io/ioutil"

View file

@ -9,13 +9,13 @@ import (
"github.com/google/uuid" "github.com/google/uuid"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model" "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/model"
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/view" "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/view"
"github.com/go-jet/jet/tests/testdata/results/common" "github.com/go-jet/jet/v2/tests/testdata/results/common"
. "github.com/go-jet/jet/mysql" . "github.com/go-jet/jet/v2/mysql"
) )
func TestAllTypes(t *testing.T) { func TestAllTypes(t *testing.T) {

View file

@ -1,9 +1,9 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/mysql" . "github.com/go-jet/jet/v2/mysql"
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
"time" "time"

View file

@ -2,10 +2,10 @@ package mysql
import ( import (
"context" "context"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/mysql" . "github.com/go-jet/jet/v2/mysql"
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model" "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/model"
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
"time" "time"

View file

@ -1,9 +1,9 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/generator/mysql" "github.com/go-jet/jet/v2/generator/mysql"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
"github.com/go-jet/jet/tests/dbconfig" "github.com/go-jet/jet/v2/tests/dbconfig"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"io/ioutil" "io/ioutil"
"os" "os"
@ -35,7 +35,7 @@ func TestGenerator(t *testing.T) {
} }
func TestCmdGenerator(t *testing.T) { func TestCmdGenerator(t *testing.T) {
goInstallJet := exec.Command("sh", "-c", "go install github.com/go-jet/jet/cmd/jet") goInstallJet := exec.Command("sh", "-c", "cd $GOPATH/src/ && GO111MODULE=off go get github.com/go-jet/jet/cmd/jet")
goInstallJet.Stderr = os.Stderr goInstallJet.Stderr = os.Stderr
err := goInstallJet.Run() err := goInstallJet.Run()
require.NoError(t, err) require.NoError(t, err)
@ -109,7 +109,7 @@ var mpaaRatingEnumFile = `
package enum package enum
import "github.com/go-jet/jet/mysql" import "github.com/go-jet/jet/v2/mysql"
var FilmRating = &struct { var FilmRating = &struct {
G mysql.StringExpression G mysql.StringExpression
@ -137,7 +137,7 @@ var actorSQLBuilderFile = `
package table package table
import ( import (
"github.com/go-jet/jet/mysql" "github.com/go-jet/jet/v2/mysql"
) )
var Actor = newActorTable() var Actor = newActorTable()
@ -220,7 +220,7 @@ var actorInfoSQLBuilderFile = `
package view package view
import ( import (
"github.com/go-jet/jet/mysql" "github.com/go-jet/jet/v2/mysql"
) )
var ActorInfo = newActorInfoTable() var ActorInfo = newActorInfoTable()

View file

@ -2,10 +2,10 @@ package mysql
import ( import (
"context" "context"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/mysql" . "github.com/go-jet/jet/v2/mysql"
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model" "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/model"
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"math/rand" "math/rand"
"testing" "testing"

View file

@ -1,9 +1,9 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/mysql" . "github.com/go-jet/jet/v2/mysql"
. "github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
) )

View file

@ -4,9 +4,9 @@ import (
"context" "context"
"database/sql" "database/sql"
"flag" "flag"
jetmysql "github.com/go-jet/jet/mysql" jetmysql "github.com/go-jet/jet/v2/mysql"
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/tests/dbconfig" "github.com/go-jet/jet/v2/tests/dbconfig"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"math/rand" "math/rand"
"time" "time"

View file

@ -1,12 +1,12 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/mysql" . "github.com/go-jet/jet/v2/mysql"
"github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/enum" "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/enum"
"github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/model" "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/model"
. "github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/table"
"github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/view" "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/view"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"

View file

@ -3,11 +3,11 @@ package mysql
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/mysql" . "github.com/go-jet/jet/v2/mysql"
"github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/table" "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/table"
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model" "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/model"
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
"time" "time"

View file

@ -1,9 +1,9 @@
package mysql package mysql
import ( import (
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/mysql" . "github.com/go-jet/jet/v2/mysql"
. "github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"strings" "strings"
"testing" "testing"

View file

@ -5,12 +5,12 @@ import (
"testing" "testing"
"time" "time"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/model" "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/model"
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/table"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/view" "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/view"
"github.com/go-jet/jet/tests/testdata/results/common" "github.com/go-jet/jet/v2/tests/testdata/results/common"
"github.com/google/uuid" "github.com/google/uuid"
) )

View file

@ -3,10 +3,10 @@ package postgres
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/chinook/model" "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/chinook/model"
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/chinook/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/chinook/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
"time" "time"

View file

@ -2,10 +2,10 @@ package postgres
import ( import (
"context" "context"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/model" "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/model"
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
"time" "time"

View file

@ -1,9 +1,9 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/generator/postgres" "github.com/go-jet/jet/v2/generator/postgres"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
"github.com/go-jet/jet/tests/dbconfig" "github.com/go-jet/jet/v2/tests/dbconfig"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"io/ioutil" "io/ioutil"
"os" "os"
@ -11,7 +11,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/dvds/model" "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/model"
) )
func TestGeneratedModel(t *testing.T) { func TestGeneratedModel(t *testing.T) {
@ -46,7 +46,7 @@ func TestGeneratedModel(t *testing.T) {
const genTestDir2 = "./.gentestdata2" const genTestDir2 = "./.gentestdata2"
func TestCmdGenerator(t *testing.T) { func TestCmdGenerator(t *testing.T) {
goInstallJet := exec.Command("sh", "-c", "go install github.com/go-jet/jet/cmd/jet") goInstallJet := exec.Command("sh", "-c", "cd $GOPATH/src/ && GO111MODULE=off go get github.com/go-jet/jet/cmd/jet")
goInstallJet.Stderr = os.Stderr goInstallJet.Stderr = os.Stderr
err := goInstallJet.Run() err := goInstallJet.Run()
require.NoError(t, err) require.NoError(t, err)
@ -142,7 +142,7 @@ var mpaaRatingEnumFile = `
package enum package enum
import "github.com/go-jet/jet/postgres" import "github.com/go-jet/jet/v2/postgres"
var MpaaRating = &struct { var MpaaRating = &struct {
G postgres.StringExpression G postgres.StringExpression
@ -170,7 +170,7 @@ var actorSQLBuilderFile = `
package table package table
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var Actor = newActorTable() var Actor = newActorTable()
@ -266,7 +266,7 @@ var actorInfoSQLBuilderFile = `
package view package view
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var ActorInfo = newActorInfoTable() var ActorInfo = newActorInfoTable()
@ -368,7 +368,7 @@ var moodEnumContent = `
package enum package enum
import "github.com/go-jet/jet/postgres" import "github.com/go-jet/jet/v2/postgres"
var Mood = &struct { var Mood = &struct {
Sad postgres.StringExpression Sad postgres.StringExpression
@ -391,7 +391,7 @@ var levelEnumContent = `
package enum package enum
import "github.com/go-jet/jet/postgres" import "github.com/go-jet/jet/v2/postgres"
var Level = &struct { var Level = &struct {
Level1 postgres.StringExpression Level1 postgres.StringExpression
@ -499,7 +499,7 @@ var allTypesTableContent = `
package table package table
import ( import (
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
) )
var AllTypes = newAllTypesTable() var AllTypes = newAllTypesTable()

View file

@ -2,10 +2,10 @@ package postgres
import ( import (
"context" "context"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/model" "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/model"
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"math/rand" "math/rand"
"testing" "testing"

View file

@ -2,13 +2,13 @@ package postgres
import ( import (
"context" "context"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
"time" "time"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/dvds/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/table"
) )
func TestLockTable(t *testing.T) { func TestLockTable(t *testing.T) {

View file

@ -3,8 +3,8 @@ package postgres
import ( import (
"context" "context"
"database/sql" "database/sql"
"github.com/go-jet/jet/postgres" "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/tests/dbconfig" "github.com/go-jet/jet/v2/tests/dbconfig"
_ "github.com/lib/pq" _ "github.com/lib/pq"
"github.com/pkg/profile" "github.com/pkg/profile"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"

View file

@ -1,9 +1,9 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/northwind/model" "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/northwind/model"
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/northwind/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/northwind/table"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
) )

View file

@ -1,10 +1,10 @@
package postgres package postgres
import ( import (
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/model" "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/model"
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/table"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"

View file

@ -2,11 +2,11 @@ package postgres
import ( import (
"fmt" "fmt"
"github.com/go-jet/jet/internal/testutils" "github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/qrm" "github.com/go-jet/jet/v2/qrm"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/dvds/model" "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/model"
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/dvds/table" . "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/table"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"

Some files were not shown because too many files have changed in this diff Show more