Skip to content

Commit

Permalink
Merge pull request #162 from doug-martin/v9.0.0-rc
Browse files Browse the repository at this point in the history
V9.0.0 rc
  • Loading branch information
doug-martin authored Sep 18, 2019
2 parents 67f00a5 + ab681c1 commit 25020dc
Show file tree
Hide file tree
Showing 120 changed files with 23,712 additions and 7,846 deletions.
10 changes: 9 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# v9.0.0

* Changed `NULL`, `TRUE`, `FALSE` to not be interpolated when creating prepared statements. [#132](https://github.com/doug-martin/goqu/pull/132), [#158](https://github.com/doug-martin/goqu/pull/158) - [@marshallmcmullen](https://github.com/marshallmcmullen)
* Updated dependencies
* `github.com/lib/pq v1.1.1 -> v1.2.0`
* `github.com/mattn/go-sqlite3 v1.10.0 -> v1.11.0`
* `github.com/stretchr/testify v1.3.0 -> v1.4.0`

## v8.6.0

* [ADDED] `SetError()` and `Error()` to all datasets. [#152](https://github.com/doug-martin/goqu/pull/152) and [#150] - [@marshallmcmullen](https://github.com/marshallmcmullen)
* [ADDED] `SetError()` and `Error()` to all datasets. [#152](https://github.com/doug-martin/goqu/pull/152) and [#150](https://github.com/doug-martin/goqu/pull/150) - [@marshallmcmullen](https://github.com/marshallmcmullen)

## v8.5.0

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![Actions Status](https://github.com/doug-martin/goqu/workflows/Test/badge.svg)](https://github.com/doug-martin/goqu/actions)
[![GoDoc](https://godoc.org/github.com/doug-martin/goqu?status.png)](http://godoc.org/github.com/doug-martin/goqu)
[![codecov](https://codecov.io/gh/doug-martin/goqu/branch/master/graph/badge.svg)](https://codecov.io/gh/doug-martin/goqu)
[![Go Report Card](https://goreportcard.com/badge/github.com/doug-martin/goqu/v8)](https://goreportcard.com/report/github.com/doug-martin/goqu/v8)
[![Go Report Card](https://goreportcard.com/badge/github.com/doug-martin/goqu/v9)](https://goreportcard.com/report/github.com/doug-martin/goqu/v9)

`goqu` is an expressive SQL builder and executor

Expand All @@ -21,12 +21,12 @@ If you are upgrading from an older version please read the [Migrating Between Ve
If using go modules.

```sh
go get -u github.com/doug-martin/goqu/v8
go get -u github.com/doug-martin/goqu/v9
```

If you are not using go modules...

**NOTE** You should still be able to use this package if you are using go version `>v1.10` but, you will need to drop the version from the package. `import "github.com/doug-martin/goqu/v8` -> `import "github.com/doug-martin/goqu"`
**NOTE** You should still be able to use this package if you are using go version `>v1.10` but, you will need to drop the version from the package. `import "github.com/doug-martin/goqu/v9` -> `import "github.com/doug-martin/goqu"`

```sh
go get -u github.com/doug-martin/goqu
Expand Down
6 changes: 3 additions & 3 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"database/sql"
"sync"

"github.com/doug-martin/goqu/v8/exec"
"github.com/doug-martin/goqu/v9/exec"
)

type (
Expand Down Expand Up @@ -42,8 +42,8 @@ type (
// import (
// "database/sql"
// "fmt"
// "github.com/doug-martin/goqu/v8"
// _ "github.com/doug-martin/goqu/v8/adapters/postgres"
// "github.com/doug-martin/goqu/v9"
// _ "github.com/doug-martin/goqu/v9/adapters/postgres"
// _ "github.com/lib/pq"
// )
//
Expand Down
2 changes: 1 addition & 1 deletion database_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"time"

"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v9"
)

func ExampleDatabase_Begin() {
Expand Down
2 changes: 1 addition & 1 deletion database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

"github.com/DATA-DOG/go-sqlmock"
"github.com/doug-martin/goqu/v8/internal/errors"
"github.com/doug-martin/goqu/v9/internal/errors"
"github.com/stretchr/testify/suite"
)

Expand Down
8 changes: 4 additions & 4 deletions delete_dataset.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package goqu

import (
"github.com/doug-martin/goqu/v8/exec"
"github.com/doug-martin/goqu/v8/exp"
"github.com/doug-martin/goqu/v8/internal/errors"
"github.com/doug-martin/goqu/v8/internal/sb"
"github.com/doug-martin/goqu/v9/exec"
"github.com/doug-martin/goqu/v9/exp"
"github.com/doug-martin/goqu/v9/internal/errors"
"github.com/doug-martin/goqu/v9/internal/sb"
)

var errBadFromArgument = errors.New("unsupported DeleteDataset#From argument, a string or identifier expression is required")
Expand Down
14 changes: 7 additions & 7 deletions delete_dataset_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package goqu_test
import (
"fmt"

"github.com/doug-martin/goqu/v8"
_ "github.com/doug-martin/goqu/v8/dialect/mysql"
"github.com/doug-martin/goqu/v9"
_ "github.com/doug-martin/goqu/v9/dialect/mysql"
)

func ExampleDelete() {
Expand Down Expand Up @@ -186,11 +186,11 @@ func ExampleDeleteDataset_Where_prepared() {
).ToSQL()
fmt.Println(sql, args)
// Output:
// DELETE FROM "test" WHERE (("a" > ?) AND ("b" < ?) AND ("c" IS NULL) AND ("d" IN (?, ?, ?))) [10 10 a b c]
// DELETE FROM "test" WHERE (("a" > ?) OR ("b" < ?) OR ("c" IS NULL) OR ("d" IN (?, ?, ?))) [10 10 a b c]
// DELETE FROM "test" WHERE ((("a" > ?) AND ("b" < ?)) OR (("c" IS NULL) AND ("d" IN (?, ?, ?)))) [10 10 a b c]
// DELETE FROM "test" WHERE (("a" > ?) AND ("b" < ?) AND ("c" IS NULL) AND ("d" IN (?, ?, ?))) [10 10 a b c]
// DELETE FROM "test" WHERE (("a" > ?) OR (("b" < ?) AND ("c" IS NULL))) [10 10]
// DELETE FROM "test" WHERE (("a" > ?) AND ("b" < ?) AND ("c" IS ?) AND ("d" IN (?, ?, ?))) [10 10 <nil> a b c]
// DELETE FROM "test" WHERE (("a" > ?) OR ("b" < ?) OR ("c" IS ?) OR ("d" IN (?, ?, ?))) [10 10 <nil> a b c]
// DELETE FROM "test" WHERE ((("a" > ?) AND ("b" < ?)) OR (("c" IS ?) AND ("d" IN (?, ?, ?)))) [10 10 <nil> a b c]
// DELETE FROM "test" WHERE (("a" > ?) AND ("b" < ?) AND ("c" IS ?) AND ("d" IN (?, ?, ?))) [10 10 <nil> a b c]
// DELETE FROM "test" WHERE (("a" > ?) OR (("b" < ?) AND ("c" IS ?))) [10 10 <nil>]
}

func ExampleDeleteDataset_ClearWhere() {
Expand Down
10 changes: 5 additions & 5 deletions delete_dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"testing"

"github.com/DATA-DOG/go-sqlmock"
"github.com/doug-martin/goqu/v8/exec"
"github.com/doug-martin/goqu/v8/exp"
"github.com/doug-martin/goqu/v8/internal/errors"
"github.com/doug-martin/goqu/v8/internal/sb"
"github.com/doug-martin/goqu/v8/mocks"
"github.com/doug-martin/goqu/v9/exec"
"github.com/doug-martin/goqu/v9/exp"
"github.com/doug-martin/goqu/v9/internal/errors"
"github.com/doug-martin/goqu/v9/internal/sb"
"github.com/doug-martin/goqu/v9/mocks"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
)
Expand Down
4 changes: 2 additions & 2 deletions dialect/mysql/mysql.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package mysql

import (
"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v8/exp"
"github.com/doug-martin/goqu/v9"
"github.com/doug-martin/goqu/v9/exp"
)

func DialectOptions() *goqu.SQLDialectOptions {
Expand Down
2 changes: 1 addition & 1 deletion dialect/mysql/mysql_dialect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"regexp"
"testing"

"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v9"
"github.com/stretchr/testify/suite"
)

Expand Down
4 changes: 2 additions & 2 deletions dialect/mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"
"time"

"github.com/doug-martin/goqu/v8"
_ "github.com/doug-martin/goqu/v8/dialect/mysql"
"github.com/doug-martin/goqu/v9"
_ "github.com/doug-martin/goqu/v9/dialect/mysql"

_ "github.com/go-sql-driver/mysql"
"github.com/stretchr/testify/suite"
Expand Down
2 changes: 1 addition & 1 deletion dialect/postgres/postgres.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package postgres

import (
"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v9"
)

func DialectOptions() *goqu.SQLDialectOptions {
Expand Down
2 changes: 1 addition & 1 deletion dialect/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v9"

"github.com/lib/pq"
"github.com/stretchr/testify/suite"
Expand Down
4 changes: 2 additions & 2 deletions dialect/sqlite3/sqlite3.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package sqlite3

import (
"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v8/exp"
"github.com/doug-martin/goqu/v9"
"github.com/doug-martin/goqu/v9/exp"
)

func DialectOptions() *goqu.SQLDialectOptions {
Expand Down
2 changes: 1 addition & 1 deletion dialect/sqlite3/sqlite3_dialect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"regexp"
"testing"

"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v9"

"github.com/stretchr/testify/suite"
)
Expand Down
2 changes: 1 addition & 1 deletion dialect/sqlite3/sqlite3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v9"
_ "github.com/mattn/go-sqlite3"

"github.com/stretchr/testify/suite"
Expand Down
10 changes: 5 additions & 5 deletions docs/deleting.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DELETE FROM "table" WHERE "foo"='bar'
Use this when you want to create SQL for a specific `dialect`

```go
// import _ "github.com/doug-martin/goqu/v8/dialect/mysql"
// import _ "github.com/doug-martin/goqu/v9/dialect/mysql"

dialect := goqu.Dialect("mysql")

Expand All @@ -71,7 +71,7 @@ DELETE FROM `table`
Use this when you want to execute the SQL or create SQL for the drivers dialect.

```go
// import _ "github.com/doug-martin/goqu/v8/dialect/mysql"
// import _ "github.com/doug-martin/goqu/v9/dialect/mysql"

mysqlDB := //initialize your db
db := goqu.New("mysql", mysqlDB)
Expand Down Expand Up @@ -118,7 +118,7 @@ fmt.Println(sql)

Output:
```
DELETE FROM "test" WHERE (("a" > ?) AND ("b" < ?) AND ("c" IS NULL) AND ("d" IN (?, ?, ?))) [10 10 a b c]
DELETE FROM "test" WHERE (("a" > ?) AND ("b" < ?) AND ("c" IS ?) AND ("d" IN (?, ?, ?))) [10 10 <nil> a b c]
```

<a name="where"></a>
Expand All @@ -145,7 +145,7 @@ DELETE FROM "test" WHERE (("a" > 10) AND ("b" < 10) AND ("c" IS NULL) AND ("d" I
**NOTE** This will only work if your dialect supports it

```go
// import _ "github.com/doug-martin/goqu/v8/dialect/mysql"
// import _ "github.com/doug-martin/goqu/v9/dialect/mysql"

ds := goqu.Dialect("mysql").Delete("test").Order(goqu.C("a").Asc())
sql, _, _ := ds.ToSQL()
Expand All @@ -163,7 +163,7 @@ DELETE FROM `test` ORDER BY `a` ASC
**NOTE** This will only work if your dialect supports it

```go
// import _ "github.com/doug-martin/goqu/v8/dialect/mysql"
// import _ "github.com/doug-martin/goqu/v9/dialect/mysql"

ds := goqu.Dialect("mysql").Delete("test").Limit(10)
sql, _, _ := ds.ToSQL()
Expand Down
22 changes: 11 additions & 11 deletions docs/dialect.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Dialects allow goqu the build the correct SQL for each database. There are three dialects that come packaged with `goqu`

* [mysql](./dialect/mysql/mysql.go) - `import _ "github.com/doug-martin/goqu/v8/dialect/mysql"`
* [postgres](./dialect/postgres/postgres.go) - `import _ "github.com/doug-martin/goqu/v8/dialect/postgres"`
* [sqlite3](./dialect/sqlite3/sqlite3.go) - `import _ "github.com/doug-martin/goqu/v8/dialect/sqlite3"`
* [mysql](./dialect/mysql/mysql.go) - `import _ "github.com/doug-martin/goqu/v9/dialect/mysql"`
* [postgres](./dialect/postgres/postgres.go) - `import _ "github.com/doug-martin/goqu/v9/dialect/postgres"`
* [sqlite3](./dialect/sqlite3/sqlite3.go) - `import _ "github.com/doug-martin/goqu/v9/dialect/sqlite3"`

**NOTE** Dialects work like drivers in go where they are not registered until you import the package.

Expand All @@ -15,9 +15,9 @@ Below are examples for each dialect. Notice how the dialect is imported and then
```go
import (
"fmt"
"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v9"
// import the dialect
_ "github.com/doug-martin/goqu/v8/dialect/postgres"
_ "github.com/doug-martin/goqu/v9/dialect/postgres"
)

// look up the dialect
Expand All @@ -43,9 +43,9 @@ SELECT * FROM "test" WHERE "id" = 10 []
```go
import (
"fmt"
"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v9"
// import the dialect
_ "github.com/doug-martin/goqu/v8/dialect/mysql"
_ "github.com/doug-martin/goqu/v9/dialect/mysql"
)

// look up the dialect
Expand All @@ -71,9 +71,9 @@ SELECT * FROM `test` WHERE `id` = 10 []
```go
import (
"fmt"
"github.com/doug-martin/goqu/v8"
"github.com/doug-martin/goqu/v9"
// import the dialect
_ "github.com/doug-martin/goqu/v8/dialect/sqlite3"
_ "github.com/doug-martin/goqu/v9/dialect/sqlite3"
)

// look up the dialect
Expand Down Expand Up @@ -103,8 +103,8 @@ In the example below notice that we imported the dialect and driver for side eff
```go
import (
"database/sql"
"github.com/doug-martin/goqu/v8"
_ "github.com/doug-martin/goqu/v8/dialect/postgres"
"github.com/doug-martin/goqu/v9"
_ "github.com/doug-martin/goqu/v9/dialect/postgres"
_ "github.com/lib/pq"
)

Expand Down
8 changes: 4 additions & 4 deletions docs/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ fmt.Println(sql, args)
Output:
```sql
SELECT * FROM "test" WHERE ((("col1" = 1) AND ("col2" IS TRUE)) OR (("col3" IS NULL) AND ("col4" = 'foo'))) []
SELECT * FROM "test" WHERE ((("col1" = ?) AND ("col2" IS TRUE)) OR (("col3" IS NULL) AND ("col4" = ?))) [1 foo]
SELECT * FROM "test" WHERE ((("col1" = ?) AND ("col2" IS ?)) OR (("col3" IS ?) AND ("col4" = ?))) [1 true <nil> foo]
```

<a name="complex"></a>
Expand Down Expand Up @@ -437,11 +437,11 @@ SELECT COUNT(*)
FROM "test"
INNER JOIN "test2" ON ("test"."fkey" = "test2"."id")
LEFT JOIN "test3" ON ("test2"."fkey" = "test3"."id")
WHERE ((("test"."name" ~ ?) AND ("test2"."amount" IS NOT NULL)) AND
(("test3"."id" IS NULL) OR ("test3"."status" IN (?, ?, ?))))
WHERE ((("test"."name" ~ ?) AND ("test2"."amount" IS NOT ?)) AND
(("test3"."id" IS ?) OR ("test3"."status" IN (?, ?, ?))))
GROUP BY "test"."user_id"
HAVING (AVG("test3"."age") > ?)
ORDER BY "test"."created" DESC NULLS LAST [^(a|b) passed active registered 10]
ORDER BY "test"."created" DESC NULLS LAST [^(a|b) <nil> <nil> passed active registered 10]
```


4 changes: 2 additions & 2 deletions docs/inserting.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ INSERT INTO "user" ("first_name", "last_name") VALUES ('Greg', 'Farley')
Use this when you want to create SQL for a specific `dialect`

```go
// import _ "github.com/doug-martin/goqu/v8/dialect/mysql"
// import _ "github.com/doug-martin/goqu/v9/dialect/mysql"

dialect := goqu.Dialect("mysql")

Expand All @@ -75,7 +75,7 @@ INSERT INTO `user` (`first_name`, `last_name`) VALUES ('Greg', 'Farley')
Use this when you want to execute the SQL or create SQL for the drivers dialect.

```go
// import _ "github.com/doug-martin/goqu/v8/dialect/mysql"
// import _ "github.com/doug-martin/goqu/v9/dialect/mysql"

mysqlDB := //initialize your db
db := goqu.New("mysql", mysqlDB)
Expand Down
4 changes: 2 additions & 2 deletions docs/selecting.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ SELECT NOW()
Use this when you want to create SQL for a specific `dialect`

```go
// import _ "github.com/doug-martin/goqu/v8/dialect/mysql"
// import _ "github.com/doug-martin/goqu/v9/dialect/mysql"

dialect := goqu.Dialect("mysql")

Expand All @@ -67,7 +67,7 @@ SELECT NOW()
Use this when you want to execute the SQL or create SQL for the drivers dialect.

```go
// import _ "github.com/doug-martin/goqu/v8/dialect/mysql"
// import _ "github.com/doug-martin/goqu/v9/dialect/mysql"

mysqlDB := //initialize your db
db := goqu.New("mysql", mysqlDB)
Expand Down
Loading

0 comments on commit 25020dc

Please sign in to comment.