Skip to content

Commit 4deece6

Browse files
committed
README updates
- Mention more infrequent changes - Add CONTRIBUTING.md - Mention maintainership in CONTRIBUTING.md
1 parent 88f3ff2 commit 4deece6

2 files changed

Lines changed: 160 additions & 96 deletions

File tree

CONTRIBUTING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributions are very welcome!
2+
3+
## First: Create an Issue
4+
5+
Even if your fix is simple, we'd like to have an issue to relate to
6+
the PR. Discussion about the architecture and value can go on the
7+
issue, leaving PR comments exclusively for coding style.
8+
9+
## Second: Make Your PR
10+
11+
- Fork the `master` branch
12+
- Make your change
13+
- Make a PR against the `master` branch
14+
15+
You don't need to wait for comments on the issue before making your
16+
PR. If you do wait for comments, you'll have a better chance of
17+
getting your PR accepted the first time around, but it's not
18+
necessary.
19+
20+
## Third: Be Patient
21+
22+
- If your change breaks backward compatibility, this becomes
23+
especially true.
24+
25+
We all have lives and jobs, and many of us are no longer on projects
26+
that make use of `gorp`. We will get back to you, but it might take a
27+
while.
28+
29+
## Fourth: Consider Becoming a Maintainer
30+
31+
We really do need help. We will likely ask you for help after a good
32+
PR, but if we don't, please create an issue requesting maintainership.
33+
Considering how few of us are currently active, we are unlikely to
34+
refuse good help.

README.md

Lines changed: 126 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,40 @@
44
[![code coverage](https://img.shields.io/coveralls/go-gorp/gorp.svg)](https://coveralls.io/r/go-gorp/gorp)
55
[![issues](https://img.shields.io/github/issues/go-gorp/gorp.svg)](https://github.com/go-gorp/gorp/issues)
66
[![godoc v1](https://img.shields.io/badge/godoc-v1-375EAB.svg)](https://godoc.org/gopkg.in/gorp.v1)
7+
[![godoc v2](https://img.shields.io/badge/godoc-v2-375EAB.svg)](https://godoc.org/gopkg.in/gorp.v2)
78
[![godoc bleeding edge](https://img.shields.io/badge/godoc-bleeding--edge-375EAB.svg)](https://godoc.org/github.com/go-gorp/gorp)
89

9-
### Update 2015-07-01 Cleanup & feature freeze ([#270](https://github.com/go-gorp/gorp/issues/270))
10+
### Update 2016-11-13: Future versions
1011

11-
We are currently cleaning up the backlog of issues and PR's. When this is done the codebase will be split into separate files and there will be breaking changes to the API's. We're also adding better tests and documentation. As a result of these changes the `master` branch will be unstable. Please use `gopkg.in/gorp.v1`. When the cleanup and changes are done, we will release `v2.0`.
12+
As many of the maintainers have become busy with other projects,
13+
progress toward the ever-elusive v2 has slowed to the point that we're
14+
only occasionally making progress outside of merging pull requests.
15+
In the interest of continuing to release, I'd like to lean toward a
16+
more maintainable path forward.
1217

13-
At this time we won't accept new feature-related pull-requests because of changes to the codebase. Please create an issue for your feature and wait until `v2.0` has been released.
14-
15-
For more information, please read [#270](https://github.com/go-gorp/gorp/issues/270).
18+
For the moment, I am releasing a v2 tag with the current feature set
19+
from master, as some of those features have been actively used and
20+
relied on by more than one project. Our next goal is to continue
21+
cleaning up the code base with non-breaking changes as much as
22+
possible, but if/when a breaking change is needed, we'll just release
23+
new versions. This allows us to continue development at whatever pace
24+
we're capable of, without delaying the release of features or refusing
25+
PRs.
1626

1727
## Introduction
1828

19-
I hesitate to call gorp an ORM. Go doesn't really have objects, at least not in the classic Smalltalk/Java sense. There goes the "O". gorp doesn't know anything about the relationships between your structs (at least not yet). So the "R" is questionable too (but I use it in the name because, well, it seemed more clever).
29+
I hesitate to call gorp an ORM. Go doesn't really have objects, at
30+
least not in the classic Smalltalk/Java sense. There goes the "O".
31+
gorp doesn't know anything about the relationships between your
32+
structs (at least not yet). So the "R" is questionable too (but I use
33+
it in the name because, well, it seemed more clever).
2034

21-
The "M" is alive and well. Given some Go structs and a database, gorp should remove a fair amount of boilerplate busy-work from your code.
35+
The "M" is alive and well. Given some Go structs and a database, gorp
36+
should remove a fair amount of boilerplate busy-work from your code.
2237

23-
I hope that gorp saves you time, minimizes the drudgery of getting data in and out of your database, and helps your code focus on algorithms, not infrastructure.
38+
I hope that gorp saves you time, minimizes the drudgery of getting
39+
data in and out of your database, and helps your code focus on
40+
algorithms, not infrastructure.
2441

2542
* Bind struct fields to table columns via API or tag
2643
* Support for embedded structs
@@ -35,42 +52,59 @@ I hope that gorp saves you time, minimizes the drudgery of getting data in and o
3552
* Bind arbitrary SQL queries to a struct
3653
* Bind slice to SELECT query results without type assertions
3754
* Use positional or named bind parameters in custom SELECT queries
38-
* Optional optimistic locking using a version column (for update/deletes)
55+
* Optional optimistic locking using a version column (for
56+
update/deletes)
3957

4058
## Installation
4159

42-
# install the library:
43-
go get gopkg.in/gorp.v1
44-
45-
// use in your .go code:
46-
import (
47-
"gopkg.in/gorp.v1"
48-
)
60+
Use `go get` or your favorite vendoring tool, using whichever import
61+
path you'd like.
4962

5063
## Versioning
5164

52-
This project provides a stable release (v1.x tags) and a bleeding edge codebase (master).
65+
We use semantic version tags. Feel free to import through `gopkg.in`
66+
(e.g. `gopkg.in/gorp.v2`) to get the latest tag for a major version,
67+
or check out the tag using your favorite vendoring tool.
5368

54-
`gopkg.in/gorp.v1` points to the latest v1.x tag. The API's for v1 are stable and shouldn't change. Development takes place at the master branch. Althought the code in master should always compile and test successfully, it might break API's. We aim to maintain backwards compatibility, but API's and behaviour might be changed to fix a bug. Also note that API's that are new in the master branch can change until released as v2.
69+
Development is not very active right now, but we have plans to
70+
restructure `gorp` as we continue to move toward a more extensible
71+
system. Whenever a breaking change is needed, the major version will
72+
be bumped.
5573

56-
If you want to use bleeding edge, use `github.com/go-gorp/gorp` as import path.
74+
The `master` branch is where all development is done, and breaking
75+
changes may happen from time to time. That said, if you want to live
76+
on the bleeding edge and are comfortable updating your code when we
77+
make a breaking change, you may use `github.com/go-gorp/gorp` as your
78+
import path.
5779

58-
## API Documentation
80+
Check the version tags to see what's available. We'll make a good
81+
faith effort to add badges for new versions, but we make no
82+
guarantees.
5983

60-
Full godoc output from the latest v1 release is available here:
84+
## Supported Go versions
6185

62-
https://godoc.org/gopkg.in/gorp.v1
86+
This package is guaranteed to be compatible with the latest 2 major
87+
versions of Go.
6388

64-
For the latest code in master:
89+
Any earlier versions are only supported on a best effort basis and can
90+
be dropped any time. Go has a great compatibility promise. Upgrading
91+
your program to a newer version of Go should never really be a
92+
problem.
6593

66-
https://godoc.org/github.com/go-gorp/gorp
94+
## Migration guide
6795

68-
## Supported Go versions
96+
#### Pre-v2 to v2
97+
Automatic mapping of the version column used in optimistic locking has
98+
been removed as it could cause problems if the type was not int. The
99+
version column must now explicitly be set with
100+
`tablemap.SetVersionCol()`.
69101

70-
This package is compatible with the last 2 major versions of Go, at this time `1.3` and `1.4`.
102+
## Help/Support
71103

72-
Any earlier versions are only supported on a best effort basis and can be dropped any time.
73-
Go has a great compatibility promise. Upgrading your program to a newer version of Go should never really be a problem.
104+
Use our [`gitter` channel](https://gitter.im/go-gorp/gorp). We used
105+
to use IRC, but with most of us being pulled in many directions, we
106+
often need the email notifications from `gitter` to yell at us to sign
107+
in.
74108

75109
## Quickstart
76110

@@ -530,10 +564,11 @@ Full list of hooks that you can implement:
530564

531565
#### Note that this behaviour has changed in v2. See [Migration Guide](#migration-guide).
532566

533-
gorp provides a simple optimistic locking feature, similar to Java's JPA, that
534-
will raise an error if you try to update/delete a row whose `version` column
535-
has a value different than the one in memory. This provides a safe way to do
536-
"select then update" style operations without explicit read and write locks.
567+
gorp provides a simple optimistic locking feature, similar to Java's
568+
JPA, that will raise an error if you try to update/delete a row whose
569+
`version` column has a value different than the one in memory. This
570+
provides a safe way to do "select then update" style operations
571+
without explicit read and write locks.
537572

538573
```go
539574
// Version is an auto-incremented number, managed by gorp
@@ -582,13 +617,15 @@ if ok {
582617
```
583618
### Adding INDEX(es) on column(s) beyond the primary key ###
584619

585-
Indexes are frequently critical for performance. Here is how to add them to your tables.
620+
Indexes are frequently critical for performance. Here is how to add
621+
them to your tables.
586622

587-
NB: SqlServer and Oracle need testing and possible adjustment to the
623+
NB: SqlServer and Oracle need testing and possible adjustment to the
588624
CreateIndexSuffix() and DropIndexSuffix() methods to make AddIndex()
589625
work for them.
590626

591-
In the example below we put an index both on the Id field, and on the AcctId field.
627+
In the example below we put an index both on the Id field, and on the
628+
AcctId field.
592629

593630
```
594631
type Account struct {
@@ -626,76 +663,85 @@ MariaDB [test]> show create table Account;
626663

627664
## Database Drivers
628665

629-
gorp uses the Go 1 `database/sql` package. A full list of compliant drivers is available here:
666+
gorp uses the Go 1 `database/sql` package. A full list of compliant
667+
drivers is available here:
630668

631669
http://code.google.com/p/go-wiki/wiki/SQLDrivers
632670

633-
Sadly, SQL databases differ on various issues. gorp provides a Dialect interface that should be
634-
implemented per database vendor. Dialects are provided for:
671+
Sadly, SQL databases differ on various issues. gorp provides a Dialect
672+
interface that should be implemented per database vendor. Dialects
673+
are provided for:
635674

636675
* MySQL
637676
* PostgreSQL
638677
* sqlite3
639678

640-
Each of these three databases pass the test suite. See `gorp_test.go` for example
641-
DSNs for these three databases.
679+
Each of these three databases pass the test suite. See `gorp_test.go`
680+
for example DSNs for these three databases.
642681

643682
Support is also provided for:
644683

645684
* Oracle (contributed by @klaidliadon)
646-
* SQL Server (contributed by @qrawl) - use driver: github.com/denisenkom/go-mssqldb
685+
* SQL Server (contributed by @qrawl) - use driver:
686+
github.com/denisenkom/go-mssqldb
647687

648-
Note that these databases are not covered by CI and I (@coopernurse) have no good way to
649-
test them locally. So please try them and send patches as needed, but expect a bit more
650-
unpredicability.
688+
Note that these databases are not covered by CI and I (@coopernurse)
689+
have no good way to test them locally. So please try them and send
690+
patches as needed, but expect a bit more unpredicability.
651691

652692
## Known Issues
653693

654694
### SQL placeholder portability
655695

656-
Different databases use different strings to indicate variable placeholders in
657-
prepared SQL statements. Unlike some database abstraction layers (such as JDBC),
658-
Go's `database/sql` does not standardize this.
696+
Different databases use different strings to indicate variable
697+
placeholders in prepared SQL statements. Unlike some database
698+
abstraction layers (such as JDBC), Go's `database/sql` does not
699+
standardize this.
659700

660-
SQL generated by gorp in the `Insert`, `Update`, `Delete`, and `Get` methods delegates
661-
to a Dialect implementation for each database, and will generate portable SQL.
701+
SQL generated by gorp in the `Insert`, `Update`, `Delete`, and `Get`
702+
methods delegates to a Dialect implementation for each database, and
703+
will generate portable SQL.
662704

663-
Raw SQL strings passed to `Exec`, `Select`, `SelectOne`, `SelectInt`, etc will not be
664-
parsed. Consequently you may have portability issues if you write a query like this:
705+
Raw SQL strings passed to `Exec`, `Select`, `SelectOne`, `SelectInt`,
706+
etc will not be parsed. Consequently you may have portability issues
707+
if you write a query like this:
665708

666-
```go
667-
// works on MySQL and Sqlite3, but not with Postgresql
668-
err := dbmap.SelectOne(&val, "select * from foo where id = ?", 30)
669-
```
709+
```go // works on MySQL and Sqlite3, but not with Postgresql err :=
710+
dbmap.SelectOne(&val, "select * from foo where id = ?", 30) ```
670711
671-
In `Select` and `SelectOne` you can use named parameters to work around this.
672-
The following is portable:
712+
In `Select` and `SelectOne` you can use named parameters to work
713+
around this. The following is portable:
673714
674-
```go
675-
err := dbmap.SelectOne(&val, "select * from foo where id = :id",
676-
map[string]interface{} { "id": 30})
677-
```
715+
```go err := dbmap.SelectOne(&val, "select * from foo where id = :id",
716+
map[string]interface{} { "id": 30}) ```
678717
679-
Additionally, when using Postgres as your database, you should utilize `$1` instead
680-
of `?` placeholders as utilizing `?` placeholders when querying Postgres will result
681-
in `pq: operator does not exist` errors. Alternatively, use
682-
`dbMap.Dialect.BindVar(varIdx)` to get the proper variable binding for your dialect.
718+
Additionally, when using Postgres as your database, you should utilize
719+
`$1` instead of `?` placeholders as utilizing `?` placeholders when
720+
querying Postgres will result in `pq: operator does not exist`
721+
errors. Alternatively, use `dbMap.Dialect.BindVar(varIdx)` to get the
722+
proper variable binding for your dialect.
683723
684724
### time.Time and time zones
685725
686-
gorp will pass `time.Time` fields through to the `database/sql` driver, but note that
687-
the behavior of this type varies across database drivers.
726+
gorp will pass `time.Time` fields through to the `database/sql`
727+
driver, but note that the behavior of this type varies across database
728+
drivers.
688729
689-
MySQL users should be especially cautious. See: https://github.com/ziutek/mymysql/pull/77
730+
MySQL users should be especially cautious. See:
731+
https://github.com/ziutek/mymysql/pull/77
690732
691-
To avoid any potential issues with timezone/DST, consider using an integer field for time
692-
data and storing UNIX time.
733+
To avoid any potential issues with timezone/DST, consider:
734+
735+
- Using an integer field for time data and storing UNIX time.
736+
- Using a custom time type that implements some SQL types:
737+
- [`"database/sql".Scanner`](https://golang.org/pkg/database/sql/#Scanner)
738+
- [`"database/sql/driver".Valuer`](https://golang.org/pkg/database/sql/driver/#Valuer)
693739
694740
## Running the tests
695741
696742
The included tests may be run against MySQL, Postgresql, or sqlite3.
697-
You must set two environment variables so the test code knows which driver to
698-
use, and how to connect to your database.
743+
You must set two environment variables so the test code knows which
744+
driver to use, and how to connect to your database.
699745
700746
```sh
701747
# MySQL example:
@@ -709,34 +755,18 @@ go test
709755
go test -bench="Bench" -benchtime 10
710756
```
711757

712-
Valid `GORP_TEST_DIALECT` values are: "mysql"(for mymysql), "gomysql"(for go-sql-driver), "postgres", "sqlite"
713-
See the `test_all.sh` script for examples of all 3 databases. This is the script I run
714-
locally to test the library.
758+
Valid `GORP_TEST_DIALECT` values are: "mysql"(for mymysql),
759+
"gomysql"(for go-sql-driver), "postgres", "sqlite" See the
760+
`test_all.sh` script for examples of all 3 databases. This is the
761+
script I run locally to test the library.
715762

716763
## Performance
717764

718-
gorp uses reflection to construct SQL queries and bind parameters. See the BenchmarkNativeCrud vs BenchmarkGorpCrud in gorp_test.go for a simple perf test. On my MacBook Pro gorp is about 2-3% slower than hand written SQL.
719-
720-
## Migration guide
721-
#### Pre-v2 to v2
722-
Automatic mapping of the version column used in optimistic locking has been removed as it could cause problems if the type was not int. The version column must now explicitly be set with tablemap.SetVersionCol().
723-
724-
## Help/Support
725-
726-
IRC: #gorp
727-
Mailing list: gorp-dev@googlegroups.com
728-
Bugs/Enhancements: Create a github issue
729-
730-
## Pull requests / Contributions
731-
732-
Contributions are very welcome. Please follow these guidelines:
733-
734-
* Fork the `master` branch and issue pull requests targeting the `master` branch
735-
* If you are adding an enhancement, please open an issue first with your proposed change.
736-
* Changes that break backwards compatibility in the public API are only accepted after we
737-
discuss on a GitHub issue for a while.
765+
gorp uses reflection to construct SQL queries and bind parameters.
766+
See the BenchmarkNativeCrud vs BenchmarkGorpCrud in gorp_test.go for a
767+
simple perf test. On my MacBook Pro gorp is about 2-3% slower than
768+
hand written SQL.
738769

739-
Thanks!
740770

741771
## Contributors
742772

0 commit comments

Comments
 (0)