Skip to content

Commit a76bd30

Browse files
authored
Merge pull request #134 from go-reform/v1-3
Version 1.3.0
2 parents b4bf68a + 6174bea commit a76bd30

28 files changed

+424
-220
lines changed

.codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
codecov:
2+
branch: v1-stable

.drone-local.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ services:
4646
DATABASE: postgres
4747

4848
mysql:
49-
image: mysql:${VERSION}
49+
image: mysql/mysql-server:${VERSION}
5050
pull: true
5151
environment:
5252
- TZ=Europe/Moscow
5353
- MYSQL_ALLOW_EMPTY_PASSWORD=1
54+
- MYSQL_ROOT_HOST=%
5455
when:
5556
matrix:
5657
DATABASE: mysql
@@ -68,7 +69,7 @@ services:
6869
matrix:
6970
include:
7071
- {
71-
GO: "golang:1.8", DATABASE: postgres, VERSION: 9.6, REFORM_DRIVER: postgres,
72+
GO: "golang:1.9", DATABASE: postgres, VERSION: 9.6, REFORM_DRIVER: postgres,
7273
REFORM_ROOT_SOURCE: "postgres://[email protected]/template1?sslmode=disable",
7374
REFORM_INIT_SOURCE: "postgres://[email protected]/reform-database?sslmode=disable&TimeZone=UTC",
7475
REFORM_TEST_SOURCE: "postgres://[email protected]/reform-database?sslmode=disable&TimeZone=America/New_York",
@@ -77,36 +78,36 @@ matrix:
7778

7879
# ANSI mode
7980
- {
80-
GO: "golang:1.8", DATABASE: mysql, VERSION: 5.7, REFORM_DRIVER: mysql,
81+
GO: "golang:1.9", DATABASE: mysql, VERSION: 5.7, REFORM_DRIVER: mysql,
8182
REFORM_ROOT_SOURCE: "root@/mysql",
82-
REFORM_INIT_SOURCE: "root@/reform-database?parseTime=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true",
83-
REFORM_TEST_SOURCE: "root@/reform-database?parseTime=true&time_zone='America%2FNew_York'&sql_mode='ANSI'"
83+
REFORM_INIT_SOURCE: "root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true",
84+
REFORM_TEST_SOURCE: "root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='America%2FNew_York'&sql_mode='ANSI'"
8485
}
8586

8687
# TRADITIONAL mode + interpolateParams=true
8788
- {
88-
GO: "golang:1.8", DATABASE: mysql, VERSION: 5.7, REFORM_DRIVER: mysql,
89+
GO: "golang:1.9", DATABASE: mysql, VERSION: 5.7, REFORM_DRIVER: mysql,
8990
REFORM_ROOT_SOURCE: "root@/mysql",
90-
REFORM_INIT_SOURCE: "root@/reform-database?parseTime=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true",
91-
REFORM_TEST_SOURCE: "root@/reform-database?parseTime=true&time_zone='America%2FNew_York'&sql_mode='TRADITIONAL'&interpolateParams=true"
91+
REFORM_INIT_SOURCE: "root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true",
92+
REFORM_TEST_SOURCE: "root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='America%2FNew_York'&sql_mode='TRADITIONAL'&interpolateParams=true"
9293
}
9394

9495
- {
95-
GO: "golang:1.8", DATABASE: sqlite3, VERSION: dummy, REFORM_DRIVER: sqlite3,
96+
GO: "golang:1.9", DATABASE: sqlite3, VERSION: dummy, REFORM_DRIVER: sqlite3,
9697
REFORM_ROOT_SOURCE: "/tmp/reform-database.sqlite3",
9798
REFORM_INIT_SOURCE: "/tmp/reform-database.sqlite3",
9899
REFORM_TEST_SOURCE: "/tmp/reform-database.sqlite3"
99100
}
100101

101102
- {
102-
GO: "golang:1.8", DATABASE: mssql, VERSION: latest, REFORM_DRIVER: mssql,
103+
GO: "golang:1.9", DATABASE: mssql, VERSION: latest, REFORM_DRIVER: mssql,
103104
REFORM_ROOT_SOURCE: "server=localhost;user id=sa;password=reform-password123",
104105
REFORM_INIT_SOURCE: "server=localhost;user id=sa;password=reform-password123;database=reform-database",
105106
REFORM_TEST_SOURCE: "server=localhost;user id=sa;password=reform-password123;database=reform-database"
106107
}
107108

108109
- {
109-
GO: "golang:1.8", DATABASE: mssql, VERSION: latest, REFORM_DRIVER: sqlserver,
110+
GO: "golang:1.9", DATABASE: mssql, VERSION: latest, REFORM_DRIVER: sqlserver,
110111
REFORM_ROOT_SOURCE: "sqlserver://sa:reform-password123@localhost",
111112
REFORM_INIT_SOURCE: "sqlserver://sa:reform-password123@localhost?database=reform-database",
112113
REFORM_TEST_SOURCE: "sqlserver://sa:reform-password123@localhost?database=reform-database"

.drone.yml

Lines changed: 117 additions & 115 deletions
Large diffs are not rendered by default.

.drone.yml.sig

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

.github/drone-gen.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ type Driver struct {
1919
}
2020

2121
type Database struct {
22-
ImageName string
23-
ImageVersions []string
24-
Drivers []Driver
22+
Name string
23+
Versions []string
24+
Drivers []Driver
2525
}
2626

2727
func main() {
2828
log.SetFlags(0)
2929
flag.Parse()
3030

3131
goImages := []string{
32-
"golang:1.6",
3332
"golang:1.7",
3433
"golang:1.8",
34+
"golang:1.9",
3535
"captncraig/go-tip",
3636
}
3737

@@ -68,16 +68,16 @@ func main() {
6868
{
6969
"mysql",
7070
"root@/mysql",
71-
"root@/reform-database?parseTime=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true",
72-
"root@/reform-database?parseTime=true&time_zone='America%2FNew_York'&sql_mode='ANSI'",
71+
"root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true",
72+
"root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='America%2FNew_York'&sql_mode='ANSI'",
7373
},
7474

7575
// TRADITIONAL mode + interpolateParams=true
7676
{
7777
"mysql",
7878
"root@/mysql",
79-
"root@/reform-database?parseTime=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true",
80-
"root@/reform-database?parseTime=true&time_zone='America%2FNew_York'&sql_mode='TRADITIONAL'&interpolateParams=true",
79+
"root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true",
80+
"root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='America%2FNew_York'&sql_mode='TRADITIONAL'&interpolateParams=true",
8181
},
8282
},
8383
},
@@ -129,7 +129,7 @@ func main() {
129129
for _, d := range db.Drivers {
130130
drivers = append(drivers, d.Name)
131131
}
132-
buf.WriteString(fmt.Sprintf("# %s: %s (drivers: %s)\n", db.ImageName, strings.Join(db.ImageVersions, ", "), strings.Join(drivers, ", ")))
132+
buf.WriteString(fmt.Sprintf("# %s: %s (drivers: %s)\n", db.Name, strings.Join(db.Versions, ", "), strings.Join(drivers, ", ")))
133133
}
134134

135135
buf.WriteString("matrix:\n")
@@ -138,11 +138,11 @@ func main() {
138138
var count int
139139
for _, g := range goImages {
140140
for _, db := range databases {
141-
for _, v := range db.ImageVersions {
141+
for _, v := range db.Versions {
142142
for _, d := range db.Drivers {
143143
fmt.Fprintf(&buf, " - {\n")
144144
fmt.Fprintf(&buf, " GO: %q, DATABASE: %s, VERSION: %s, REFORM_DRIVER: %s,\n",
145-
g, db.ImageName, v, d.Name)
145+
g, db.Name, v, d.Name)
146146
fmt.Fprintf(&buf, " REFORM_ROOT_SOURCE: %q,\n", d.RootSource)
147147
fmt.Fprintf(&buf, " REFORM_INIT_SOURCE: %q,\n", d.InitSource)
148148
fmt.Fprintf(&buf, " REFORM_TEST_SOURCE: %q", d.TestSource)

.github/reform.png

6.24 KB
Loading

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.vscode/
22
.idea/
33
*.cover
4+
coverage.txt

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ env:
1212
- TARGET=sqlite3
1313

1414
go:
15-
- 1.6.x
1615
- 1.7.x
1716
- 1.8.x
18-
- tip
17+
- 1.9.x
18+
- master
1919

2020
go_import_path: gopkg.in/reform.v1
2121

@@ -27,11 +27,12 @@ install:
2727
- make install_deps
2828

2929
script:
30-
- make test $TARGET
30+
- make test
31+
- make $TARGET
3132
- make check
3233

3334
after_success:
34-
- goveralls -coverprofile=$TARGET.cover
35+
- bash <(curl -s https://codecov.io/bash) -X fix
3536

3637
notifications:
3738
webhooks:

CHANGELOG.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,54 @@
11
# Changelog
22

3-
## Not released yet
4-
5-
* `reform-db` command.
6-
* Field with `reform` tag with value `"-"` is ignored now (just like with value `""` and without tag at all).
7-
* `ErrTxDone`.
3+
## v1.3.0 (2017-12-01, https://github.com/go-reform/reform/milestones/v1.3.0)
4+
5+
* Go 1.7+ is now required.
6+
* Added `reform-db` command.
7+
* `init` subcommand may be used to generate Go model files for existing database schema.
8+
* `query` and `exec` subcommands may be used for accessing a database.
9+
* Fields with `reform` tag with value `"-"` are ignored now (just like with value `""` and without tag at all).
10+
* Added [`ErrTxDone`](https://godoc.org/gopkg.in/reform.v1#pkg-variables).
11+
* Added [`DB.DBInterface`](https://godoc.org/gopkg.in/reform.v1#DB.DBInterface).
12+
* Added [`Querier.UpdateView`](https://godoc.org/gopkg.in/reform.v1#Querier.UpdateView).
13+
* `reform` command with `-gofmt=false` flag still formats generated sources with go/format package, without invoking `gofmt`.
14+
Thanks to [João Pereira](https://github.com/joaodrp).
15+
* Added support for `sqlserver` variant of [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb) driver.
16+
* Added support for Microsoft SQL Server for Linux.
17+
* We now have a logo! Huge thanks to Natalya Glebova for making it.
818

919
## v1.2.1 (2016-09-14, https://github.com/go-reform/reform/milestones/v1.2.1)
1020

1121
* `reform` command now correctly handles non-exported types.
12-
* Querier.Insert now correctly INSERTs records with set non-integer primary keys, even if
13-
dialect uses LastInsertId (MySQL, SQLite3).
22+
* [`Querier.Insert`](https://godoc.org/gopkg.in/reform.v1#Querier.Insert) now correctly INSERTs records with set
23+
non-integer primary keys, even if dialect uses LastInsertId (MySQL, SQLite3).
1424

1525
## v1.2.0 (2016-08-10, https://github.com/go-reform/reform/milestones/v1.2.0)
1626

1727
* Added support for Microsoft SQL Server. Huge thanks to [Aleksey Martynov](https://github.com/AlekseyMartynov).
18-
* Added Querier.InsertColumns.
19-
* Querier.Insert now correctly handles records with only primary key column.
28+
* Added [`Querier.InsertColumns`](https://godoc.org/gopkg.in/reform.v1#Querier.InsertColumns).
29+
* [`Querier.Insert`](https://godoc.org/gopkg.in/reform.v1#Querier.Insert) now correctly handles records with only primary key column.
2030

2131
## v1.1.2 (2016-07-20, https://github.com/go-reform/reform/milestones/v1.1.2)
2232

2333
* `reform` command now correctly ignores type information when it's not used.
2434
This allows one to have fields of any custom types. The only exception is primary key fields,
2535
which are restricted to basic types (numbers and strings).
26-
* Package `gopkg.in/reform.v1/parse` is explicitly documented as internal.
36+
* Package [`gopkg.in/reform.v1/parse`](https://godoc.org/gopkg.in/reform.v1/parse) is explicitly documented as internal.
2737
(It's wasn't really possible to use it.)
2838

2939
## v1.1.1 (2016-07-05, https://github.com/go-reform/reform/milestones/v1.1.1)
3040

31-
* Querier.UpdateColumns no longer allows to update primary key column. This behavior was allowed,
32-
but did not make any sense.
41+
* [`Querier.UpdateColumns`](https://godoc.org/gopkg.in/reform.v1#Querier.UpdateColumns) no longer allows to update
42+
primary key column. This behavior was allowed, but did not make any sense.
3343
* `reform` command now correctly handles pointers to custom types and slices.
3444

3545
## v1.1.0 (2016-07-01, https://github.com/go-reform/reform/milestones/v1.1.0)
3646

37-
* Added Querier.InsertMulti.
38-
* Added DBInterface, TXInterface, NewDBFromInterface, NewTXFromInterface.
47+
* Added [`Querier.InsertMulti`](https://godoc.org/gopkg.in/reform.v1#Querier.InsertMulti).
48+
* Added [`DBInterface`](https://godoc.org/gopkg.in/reform.v1#DBInterface),
49+
[`TXInterface`](https://godoc.org/gopkg.in/reform.v1#TXInterface),
50+
[`NewDBFromInterface`](https://godoc.org/gopkg.in/reform.v1#NewDBFromInterface),
51+
[`NewTXFromInterface`](https://godoc.org/gopkg.in/reform.v1#NewTXFromInterface).
3952

4053
## v1.0.0 (2016-06-22)
4154

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ download_deps:
1717
github.com/stretchr/testify/... \
1818
github.com/enodata/faker \
1919
github.com/alecthomas/gometalinter \
20-
github.com/AlekSi/goveralls
20+
github.com/AlekSi/gocoverutil
2121

2222
# download linters
2323
go install -v github.com/alecthomas/gometalinter
2424
gometalinter --install --update --download-only
2525

2626
install_deps:
2727
go install -v github.com/alecthomas/gometalinter \
28-
github.com/AlekSi/goveralls
28+
github.com/AlekSi/gocoverutil
2929
gometalinter --install
3030
go test -i -v
3131

3232
# run unit tests, generate models, install tools
3333
test:
34-
rm -f *.cover
34+
rm -f *.cover coverage.txt
3535
rm -f internal/test/models/*_reform.go
3636
rm -f reform-db/*_reform.go
3737

3838
go install -v gopkg.in/reform.v1/reform
39-
go test $(REFORM_TEST_FLAGS) -coverprofile=parse.cover gopkg.in/reform.v1/parse
39+
go test $(REFORM_TEST_FLAGS) -covermode=count -coverprofile=parse.cover gopkg.in/reform.v1/parse
4040
go generate -v -x gopkg.in/reform.v1/internal/test/models
4141
go install -v gopkg.in/reform.v1/internal/test/models
4242

@@ -54,8 +54,10 @@ test-db:
5454
internal/test/sql/data.sql \
5555
internal/test/sql/$(DATABASE)_data.sql \
5656
internal/test/sql/$(DATABASE)_set.sql
57-
go test $(REFORM_TEST_FLAGS) -coverprofile=$(REFORM_DRIVER)-reform-db.cover gopkg.in/reform.v1/reform-db
58-
go test $(REFORM_TEST_FLAGS) -coverprofile=$(REFORM_DRIVER).cover
57+
go test $(REFORM_TEST_FLAGS) -covermode=count -coverprofile=$(REFORM_DRIVER)-reform-db.cover gopkg.in/reform.v1/reform-db
58+
go test $(REFORM_TEST_FLAGS) -covermode=count -coverprofile=$(REFORM_DRIVER).cover
59+
gocoverutil -coverprofile=coverage.txt merge *.cover
60+
rm -f *.cover
5961

6062
check:
6163
-gometalinter ./... --deadline=180s --severity=vet:error
@@ -76,8 +78,8 @@ postgres: test
7678
mysql: export DATABASE = mysql
7779
mysql: export REFORM_DRIVER = mysql
7880
mysql: export REFORM_ROOT_SOURCE = root@/mysql
79-
mysql: export REFORM_INIT_SOURCE = root@/reform-database?parseTime=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true
80-
mysql: export REFORM_TEST_SOURCE = root@/reform-database?parseTime=true&time_zone='America%2FNew_York'
81+
mysql: export REFORM_INIT_SOURCE = root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='UTC'&sql_mode='ANSI'&multiStatements=true
82+
mysql: export REFORM_TEST_SOURCE = root@/reform-database?parseTime=true&clientFoundRows=true&time_zone='America%2FNew_York'
8183
mysql: test
8284
make test-db
8385

0 commit comments

Comments
 (0)