Add go mod support.

This commit is contained in:
go-jet 2020-06-27 18:48:19 +02:00
parent 6437e041ee
commit 2ada2ff69b
103 changed files with 273 additions and 229 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)
[![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)
[![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)
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 interacting with database from Go, which includes type-safe SQL builder with a code generation and automatic query result
data mapping.
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 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 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'

View file

@ -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
View file

@ -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:

View file

@ -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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -8,7 +8,7 @@
package view
import (
"github.com/go-jet/jet/postgres"
"github.com/go-jet/jet/v2/postgres"
)
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
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 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 (

View file

@ -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"
)

View file

@ -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

View file

@ -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"
)

View file

@ -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"
)

View file

@ -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}}

View file

@ -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"
)

View file

@ -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"
)

View file

@ -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"
)

View file

@ -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
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
import (
"github.com/go-jet/jet/internal/utils"
"github.com/go-jet/jet/v2/internal/utils"
)
// Clause interface

View file

@ -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"

View file

@ -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)

View file

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

View file

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

View file

@ -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

View file

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

View file

@ -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"

View file

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

View file

@ -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

View file

@ -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 {

View file

@ -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.

View file

@ -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.

View file

@ -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

View file

@ -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 {

View file

@ -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

View file

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

View file

@ -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 {

View file

@ -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

View file

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

View file

@ -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 {

View file

@ -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.

View file

@ -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 {

View file

@ -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

View file

@ -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 {

View file

@ -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"
)

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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.

View file

@ -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

View file

@ -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 {

View file

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

View file

@ -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.

View file

@ -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

View file

@ -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 {

View file

@ -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"

View file

@ -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"

View file

@ -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

View file

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

View file

@ -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

View file

@ -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

View file

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

View file

@ -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 {

View file

@ -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.

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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")

View file

@ -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 {

View file

@ -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"
)

View file

@ -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"
)

View file

@ -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"

View file

@ -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"

View file

@ -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) {

View file

@ -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"

View file

@ -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"

View file

@ -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()

View file

@ -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"

View file

@ -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"
)

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"
)

View file

@ -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"

View file

@ -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"

View file

@ -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()

View file

@ -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"

View file

@ -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) {

View file

@ -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"

View file

@ -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"
)

View file

@ -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"

View file

@ -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"

View file

@ -2,12 +2,12 @@ package postgres
import (
"fmt"
"github.com/go-jet/jet/internal/testutils"
. "github.com/go-jet/jet/postgres"
"github.com/go-jet/jet/tests/.gentestdata/jetdb/dvds/enum"
"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/tests/.gentestdata/jetdb/dvds/view"
"github.com/go-jet/jet/v2/internal/testutils"
. "github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/enum"
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/model"
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/table"
"github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/dvds/view"
"github.com/stretchr/testify/require"
"testing"
"time"

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