Remove the Gorp dependency

Removed the underlying Gorp package as a dependency & replaced with use of the standard database/sql driver.

This removes a dependency and makes this package very lightweight and makes database interactions very transparent. Lastly, from the standpoint of unit testing where you want to mock the database layer instead of requiring a real database, you can now easily use a package like [go-SQLMock](https://github.com/DATA-DOG/go-sqlmock) to do just that.

The tests may/not pass for Golang 1.5; it appears that the problem is Travis need to install a linter.
This commit is contained in:
Chris Johnson
2016-08-11 15:06:09 -04:00
parent f5f86fd237
commit 1eb5e3d517
5 changed files with 84 additions and 42 deletions

View File

@@ -1,3 +1,5 @@
DHOST = $(shell echo $$(docker-machine ip))
all: get-deps build
.PHONY: build
@@ -18,7 +20,7 @@ check:
.PHONY: metalint
metalint:
which gometalinter > /dev/null || (go get github.com/alecthomas/gometalinter && gometalinter --install --update)
gometalinter --cyclo-over=20 -e "struct field Id should be ID" --enable="gofmt -s" --enable=misspell --fast ./...
gometalinter --cyclo-over=20 --enable="gofmt -s" --enable=misspell --fast ./...
.PHONY: fmt
fmt:
@@ -27,9 +29,11 @@ fmt:
.PHONY: docker-test
docker-test:
docker run -d -p 5432:5432 --name=pgstore_test_1 postgres:9.4
sleep 5
@echo "Ugly hack: Sleeping for 75 secs to give the Postgres container time to come up..."
sleep 75
@echo "Waking up - let's do this!"
docker run --rm --link pgstore_test_1:postgres postgres:9.4 psql -c 'create database test;' -U postgres -h postgres
PGSTORE_TEST_CONN="postgres://postgres@127.0.0.1:5432/test?sslmode=disable" make test
PGSTORE_TEST_CONN="postgres://postgres@$(DHOST):5432/test?sslmode=disable" make test
docker kill pgstore_test_1
docker rm pgstore_test_1