Merge pull request #42 from go-jet/develop
Add support for go.mod (v2.4.0)
This commit is contained in:
commit
fdde2ab9b4
104 changed files with 275 additions and 231 deletions
30
README.md
30
README.md
|
|
@ -4,15 +4,15 @@
|
|||
[](https://codecov.io/gh/go-jet/jet)
|
||||
[](https://goreportcard.com/report/github.com/go-jet/jet)
|
||||
[](http://godoc.org/github.com/go-jet/jet)
|
||||
[](https://github.com/go-jet/jet/releases)
|
||||
[](https://github.com/go-jet/jet/v2/releases)
|
||||
[](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
|
||||
convert database query result into desired arbitrary object structure.
|
||||
Jet is a complete solution for efficient and high performance database access, consisting of type-safe SQL builder
|
||||
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 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.__
|
||||
|
||||
## 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.
|
||||
|
||||
[Go](https://golang.org/) **version 1.8+ is required**
|
||||
[Go](https://golang.org/) **version 1.9+ is required**
|
||||
|
||||
### 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
|
||||
$ 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.
|
||||
|
||||
```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
|
||||
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
|
||||
schema `dvds` we will use this command:
|
||||
```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
|
||||
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 (
|
||||
// dot import so go code would resemble as much as native SQL
|
||||
// dot import is not mandatory
|
||||
. "github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/table"
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
. "github.com/go-jet/jet/v2/examples/quick-start/.gen/jetdb/dvds/table"
|
||||
. "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'
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
mysqlgen "github.com/go-jet/jet/generator/mysql"
|
||||
postgresgen "github.com/go-jet/jet/generator/postgres"
|
||||
"github.com/go-jet/jet/mysql"
|
||||
"github.com/go-jet/jet/postgres"
|
||||
mysqlgen "github.com/go-jet/jet/v2/generator/mysql"
|
||||
postgresgen "github.com/go-jet/jet/v2/generator/postgres"
|
||||
"github.com/go-jet/jet/v2/mysql"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/lib/pq"
|
||||
"os"
|
||||
|
|
|
|||
13
doc.go
13
doc.go
|
|
@ -6,13 +6,16 @@ result into desired arbitrary object structure.
|
|||
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
|
||||
|
||||
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
|
||||
|
||||
|
|
@ -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"
|
||||
|
||||
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:
|
||||
. "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.
|
||||
|
||||
Write SQL:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
package enum
|
||||
|
||||
import "github.com/go-jet/jet/postgres"
|
||||
import "github.com/go-jet/jet/v2/postgres"
|
||||
|
||||
var MpaaRating = &struct {
|
||||
G postgres.StringExpression
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Actor = newActorTable()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Category = newCategoryTable()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Film = newFilmTable()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var FilmActor = newFilmActorTable()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var FilmCategory = newFilmCategoryTable()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Language = newLanguageTable()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package view
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var ActorInfo = newActorInfoTable()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package view
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var CustomerList = newCustomerListTable()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ import (
|
|||
|
||||
// dot import so that jet go code would resemble as much as native SQL
|
||||
// dot import is not mandatory
|
||||
. "github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/table"
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
. "github.com/go-jet/jet/v2/examples/quick-start/.gen/jetdb/dvds/table"
|
||||
. "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 (
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package metadata
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package metadata
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
)
|
||||
|
||||
// SchemaMetaData struct
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package metadata
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package template
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ var tableSQLBuilderTemplate = `
|
|||
package {{param "package"}}
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/{{dialect.PackageName}}"
|
||||
"github.com/go-jet/jet/v2/{{dialect.PackageName}}"
|
||||
)
|
||||
|
||||
var {{ToGoIdentifier .Name}} = new{{.GoStructName}}()
|
||||
|
|
@ -77,7 +77,7 @@ var tablePostgreSQLBuilderTemplate = `
|
|||
package {{param "package"}}
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/{{dialect.PackageName}}"
|
||||
"github.com/go-jet/jet/v2/{{dialect.PackageName}}"
|
||||
)
|
||||
|
||||
var {{ToGoIdentifier .Name}} = new{{.GoStructName}}()
|
||||
|
|
@ -158,7 +158,7 @@ type {{ToGoIdentifier .Name}} struct {
|
|||
`
|
||||
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 {
|
||||
{{- range $index, $element := .Values}}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package mysql
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/generator/internal/template"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/mysql"
|
||||
"github.com/go-jet/jet/v2/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/v2/generator/internal/template"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"github.com/go-jet/jet/v2/mysql"
|
||||
"path"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package mysql
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"github.com/go-jet/jet/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package postgres
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/generator/internal/template"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/v2/generator/internal/template"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
"path"
|
||||
"strconv"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package postgres
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"github.com/go-jet/jet/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/generator/internal/metadata"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
)
|
||||
|
||||
// postgresQuerySet is dialect query set for PostgreSQL
|
||||
|
|
|
|||
12
go.mod
Normal file
12
go.mod
Normal 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
23
go.sum
Normal 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=
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package jet
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
)
|
||||
|
||||
// Clause interface
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ type Expression interface {
|
|||
|
||||
// ASC expression will be used to sort query result in ascending order
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ func (e *ExpressionInterfaceImpl) ASC() OrderByClause {
|
|||
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 {
|
||||
return newOrderByClause(e.Parent, false)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package jet
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/3rdparty/pq"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/3rdparty/pq"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"github.com/google/uuid"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package jet
|
|||
import (
|
||||
"context"
|
||||
"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)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package jet
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
)
|
||||
|
||||
// SerializerTable interface
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package jet
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/qrm"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"github.com/go-jet/jet/v2/qrm"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io/ioutil"
|
||||
|
|
@ -40,8 +40,8 @@ func AssertExecErr(t *testing.T, stmt jet.Statement, db qrm.DB, errorStr string)
|
|||
}
|
||||
|
||||
func getFullPath(relativePath string) string {
|
||||
goPath := os.Getenv("GOPATH")
|
||||
return filepath.Join(goPath, "src/github.com/go-jet/jet/tests", relativePath)
|
||||
path, _ := os.Getwd()
|
||||
return filepath.Join(path, "../", relativePath)
|
||||
}
|
||||
|
||||
// PrintJson print v as json
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package testutils
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package utils
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/3rdparty/snaker"
|
||||
"github.com/go-jet/jet/v2/internal/3rdparty/snaker"
|
||||
"go/format"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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.
|
||||
type Column = jet.ColumnExpression
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type DeleteStatement interface {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mysql
|
||||
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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.
|
||||
// Can be Bool, Int, Float, String, Date, Time, Timez, Timestamp or Timestampz expressions.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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.
|
||||
var ROW = jet.ROW
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type InsertStatement interface {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import (
|
|||
"regexp"
|
||||
"time"
|
||||
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
)
|
||||
|
||||
type unitType string
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type LockStatement interface {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mysql
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type SelectTable interface {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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.
|
||||
// It eliminates duplicate rows from its result.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type Table interface {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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)
|
||||
type Statement = jet.Statement
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type UpdateStatement interface {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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.
|
||||
type CommonTableExpression struct {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
)
|
||||
|
||||
type cast interface {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
)
|
||||
|
||||
type clauseReturning struct {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package postgres
|
||||
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package postgres
|
||||
|
||||
import "github.com/go-jet/jet/internal/jet"
|
||||
import "github.com/go-jet/jet/v2/internal/jet"
|
||||
|
||||
type conflictAction interface {
|
||||
jet.Serializer
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type DeleteStatement interface {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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.
|
||||
// Can be Bool, Int, Float, String, Date, Time, Timez, Timestamp or Timestampz expressions.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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.
|
||||
var ROW = jet.ROW
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type InsertStatement interface {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package postgres
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package postgres
|
||||
|
||||
import "github.com/go-jet/jet/internal/jet"
|
||||
import "github.com/go-jet/jet/v2/internal/jet"
|
||||
|
||||
const (
|
||||
// DEFAULT is jet equivalent of SQL DEFAULT
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type TableLockMode string
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
var NOT = jet.NOT
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"math"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type SelectTable interface {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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.
|
||||
// It eliminates duplicate rows from its result.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
type Table interface {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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)
|
||||
type Statement = jet.Statement
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
)
|
||||
|
||||
// UpdateStatement is interface of SQL UPDATE statement
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package postgres
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-jet/jet/internal/jet"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
"github.com/go-jet/jet/v2/internal/jet"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
)
|
||||
|
||||
var table1Col1 = IntegerColumn("col1")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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.
|
||||
type CommonTableExpression struct {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package qrm
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"database/sql"
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"reflect"
|
||||
"strings"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package qrm
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/qrm/internal"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"github.com/go-jet/jet/v2/qrm/internal"
|
||||
"github.com/google/uuid"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import (
|
|||
"database/sql"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/generator/mysql"
|
||||
"github.com/go-jet/jet/generator/postgres"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/go-jet/jet/tests/dbconfig"
|
||||
"github.com/go-jet/jet/v2/generator/mysql"
|
||||
"github.com/go-jet/jet/v2/generator/postgres"
|
||||
"github.com/go-jet/jet/v2/internal/utils"
|
||||
"github.com/go-jet/jet/v2/tests/dbconfig"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/lib/pq"
|
||||
"io/ioutil"
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ import (
|
|||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/view"
|
||||
"github.com/go-jet/jet/tests/testdata/results/common"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/view"
|
||||
"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) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/mysql"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/mysql"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package mysql
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/mysql"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/mysql"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/generator/mysql"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
"github.com/go-jet/jet/tests/dbconfig"
|
||||
"github.com/go-jet/jet/v2/generator/mysql"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
"github.com/go-jet/jet/v2/tests/dbconfig"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
|
@ -35,7 +35,7 @@ func TestGenerator(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
|
||||
err := goInstallJet.Run()
|
||||
require.NoError(t, err)
|
||||
|
|
@ -109,7 +109,7 @@ var mpaaRatingEnumFile = `
|
|||
|
||||
package enum
|
||||
|
||||
import "github.com/go-jet/jet/mysql"
|
||||
import "github.com/go-jet/jet/v2/mysql"
|
||||
|
||||
var FilmRating = &struct {
|
||||
G mysql.StringExpression
|
||||
|
|
@ -137,7 +137,7 @@ var actorSQLBuilderFile = `
|
|||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/mysql"
|
||||
"github.com/go-jet/jet/v2/mysql"
|
||||
)
|
||||
|
||||
var Actor = newActorTable()
|
||||
|
|
@ -220,7 +220,7 @@ var actorInfoSQLBuilderFile = `
|
|||
package view
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/mysql"
|
||||
"github.com/go-jet/jet/v2/mysql"
|
||||
)
|
||||
|
||||
var ActorInfo = newActorInfoTable()
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package mysql
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/mysql"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/mysql"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/mysql"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/mysql"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import (
|
|||
"context"
|
||||
"database/sql"
|
||||
"flag"
|
||||
jetmysql "github.com/go-jet/jet/mysql"
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/tests/dbconfig"
|
||||
jetmysql "github.com/go-jet/jet/v2/mysql"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/go-jet/jet/v2/tests/dbconfig"
|
||||
"github.com/stretchr/testify/require"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/mysql"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/enum"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/table"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/view"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/mysql"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/enum"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/table"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/view"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"testing"
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ package mysql
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/mysql"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/table"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/mysql"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/table"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/mysql"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/mysql"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/mysql/dvds/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"strings"
|
||||
"testing"
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/table"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/view"
|
||||
"github.com/go-jet/jet/tests/testdata/results/common"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/table"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/view"
|
||||
"github.com/go-jet/jet/v2/tests/testdata/results/common"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package postgres
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/jetdb/chinook/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/chinook/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/chinook/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/chinook/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package postgres
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/generator/postgres"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
"github.com/go-jet/jet/tests/dbconfig"
|
||||
"github.com/go-jet/jet/v2/generator/postgres"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
"github.com/go-jet/jet/v2/tests/dbconfig"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"reflect"
|
||||
"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) {
|
||||
|
|
@ -46,7 +46,7 @@ func TestGeneratedModel(t *testing.T) {
|
|||
const genTestDir2 = "./.gentestdata2"
|
||||
|
||||
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
|
||||
err := goInstallJet.Run()
|
||||
require.NoError(t, err)
|
||||
|
|
@ -142,7 +142,7 @@ var mpaaRatingEnumFile = `
|
|||
|
||||
package enum
|
||||
|
||||
import "github.com/go-jet/jet/postgres"
|
||||
import "github.com/go-jet/jet/v2/postgres"
|
||||
|
||||
var MpaaRating = &struct {
|
||||
G postgres.StringExpression
|
||||
|
|
@ -170,7 +170,7 @@ var actorSQLBuilderFile = `
|
|||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Actor = newActorTable()
|
||||
|
|
@ -266,7 +266,7 @@ var actorInfoSQLBuilderFile = `
|
|||
package view
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var ActorInfo = newActorInfoTable()
|
||||
|
|
@ -368,7 +368,7 @@ var moodEnumContent = `
|
|||
|
||||
package enum
|
||||
|
||||
import "github.com/go-jet/jet/postgres"
|
||||
import "github.com/go-jet/jet/v2/postgres"
|
||||
|
||||
var Mood = &struct {
|
||||
Sad postgres.StringExpression
|
||||
|
|
@ -391,7 +391,7 @@ var levelEnumContent = `
|
|||
|
||||
package enum
|
||||
|
||||
import "github.com/go-jet/jet/postgres"
|
||||
import "github.com/go-jet/jet/v2/postgres"
|
||||
|
||||
var Level = &struct {
|
||||
Level1 postgres.StringExpression
|
||||
|
|
@ -499,7 +499,7 @@ var allTypesTableContent = `
|
|||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var AllTypes = newAllTypesTable()
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package postgres
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ package postgres
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/dvds/table"
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/table"
|
||||
)
|
||||
|
||||
func TestLockTable(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package postgres
|
|||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/tests/dbconfig"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/go-jet/jet/v2/tests/dbconfig"
|
||||
_ "github.com/lib/pq"
|
||||
"github.com/pkg/profile"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/jetdb/northwind/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/northwind/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/northwind/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/northwind/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_sample/table"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ package postgres
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/qrm"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/jetdb/dvds/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/dvds/table"
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/go-jet/jet/v2/qrm"
|
||||
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/model"
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/table"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue