Skip to content
Permalink
Browse files

fix build

  • Loading branch information...
birdayz committed Apr 9, 2019
1 parent 02065bd commit 79866eebcbb4a3142550be7eac501576568ce1e8
Showing with 276 additions and 6,907 deletions.
  1. +1 −1 .circleci/config.yml
  2. +7 −0 e2e/docker-compose.yaml
  3. +2 −9 go.mod
  4. +2 −16 go.sum
  5. +15 −4 pkg/timeseries/repo_test.go
  6. +24 −0 vendor/github.com/jeremywohl/flatten/.gitignore
  7. +1 −0 vendor/github.com/jeremywohl/flatten/.travis.yml
  8. +1 −1 vendor/github.com/{jinzhu/inflection → jeremywohl/flatten}/LICENSE
  9. +54 −0 vendor/github.com/jeremywohl/flatten/README.md
  10. +4 −0 vendor/github.com/jeremywohl/flatten/TODO
  11. +162 −0 vendor/github.com/jeremywohl/flatten/flatten.go
  12. +0 −11 vendor/github.com/jinzhu/gorm/.codeclimate.yml
  13. +0 −2 vendor/github.com/jinzhu/gorm/.gitignore
  14. +0 −21 vendor/github.com/jinzhu/gorm/License
  15. +0 −40 vendor/github.com/jinzhu/gorm/README.md
  16. +0 −377 vendor/github.com/jinzhu/gorm/association.go
  17. +0 −242 vendor/github.com/jinzhu/gorm/callback.go
  18. +0 −164 vendor/github.com/jinzhu/gorm/callback_create.go
  19. +0 −63 vendor/github.com/jinzhu/gorm/callback_delete.go
  20. +0 −104 vendor/github.com/jinzhu/gorm/callback_query.go
  21. +0 −404 vendor/github.com/jinzhu/gorm/callback_query_preload.go
  22. +0 −30 vendor/github.com/jinzhu/gorm/callback_row_query.go
  23. +0 −170 vendor/github.com/jinzhu/gorm/callback_save.go
  24. +0 −121 vendor/github.com/jinzhu/gorm/callback_update.go
  25. +0 −138 vendor/github.com/jinzhu/gorm/dialect.go
  26. +0 −176 vendor/github.com/jinzhu/gorm/dialect_common.go
  27. +0 −191 vendor/github.com/jinzhu/gorm/dialect_mysql.go
  28. +0 −143 vendor/github.com/jinzhu/gorm/dialect_postgres.go
  29. +0 −107 vendor/github.com/jinzhu/gorm/dialect_sqlite3.go
  30. +0 −30 vendor/github.com/jinzhu/gorm/docker-compose.yml
  31. +0 −72 vendor/github.com/jinzhu/gorm/errors.go
  32. +0 −66 vendor/github.com/jinzhu/gorm/field.go
  33. +0 −20 vendor/github.com/jinzhu/gorm/interface.go
  34. +0 −211 vendor/github.com/jinzhu/gorm/join_table_handler.go
  35. +0 −119 vendor/github.com/jinzhu/gorm/logger.go
  36. +0 −792 vendor/github.com/jinzhu/gorm/main.go
  37. +0 −14 vendor/github.com/jinzhu/gorm/model.go
  38. +0 −640 vendor/github.com/jinzhu/gorm/model_struct.go
  39. +0 −124 vendor/github.com/jinzhu/gorm/naming.go
  40. +0 −1,397 vendor/github.com/jinzhu/gorm/scope.go
  41. +0 −153 vendor/github.com/jinzhu/gorm/search.go
  42. +0 −5 vendor/github.com/jinzhu/gorm/test_all.sh
  43. +0 −226 vendor/github.com/jinzhu/gorm/utils.go
  44. +0 −148 vendor/github.com/jinzhu/gorm/wercker.yml
  45. +0 −55 vendor/github.com/jinzhu/inflection/README.md
  46. +0 −273 vendor/github.com/jinzhu/inflection/inflections.go
  47. +0 −23 vendor/github.com/jinzhu/inflection/wercker.yml
  48. +3 −4 vendor/modules.txt
@@ -56,7 +56,7 @@ jobs:
command: docker cp ./ testrunner:/project
- run:
name: run tests
command: docker exec -e DB_ADDR="redis:6379" -e DGRAPH_URL=server:9080 -it testrunner bash -c 'cd /project && CGO_ENABLED=0 go run -mod=vendor hack/import_dgraph_sample_data.go -drop && go test -mod=vendor ./...'
command: docker exec -e TIMESERIES_URL="postgres://postgres:postgres@timescaledb/postgres?sslmode=disable" -e DB_ADDR="redis:6379" -e DGRAPH_URL=server:9080 -it testrunner bash -c 'cd /project && CGO_ENABLED=0 go run -mod=vendor hack/import_dgraph_sample_data.go -drop && go test -mod=vendor ./...'
workflows:
version: 2
all:
@@ -1,5 +1,12 @@
version: "3.2"
services:
timescaledb:
image: timescale/timescaledb:latest-pg11
restart: unless-stopped
environment:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
zero:
image: dgraph/dgraph:v1.0.12-rc5
volumes:
11 go.mod
@@ -9,23 +9,18 @@ require (
github.com/avast/retry-go v2.2.0+incompatible
github.com/birdayz/conjungo v1.0.1-0.20181127234741-4eb7246db343
github.com/cskr/pubsub v1.0.1
github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f // indirect
github.com/dgraph-io/dgo v0.0.0-20181226155115-a20f509ade83
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/eapache/go-resiliency v1.1.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
github.com/evanphx/json-patch v4.1.0+incompatible
github.com/fatih/color v1.7.0 // indirect
github.com/go-sql-driver/mysql v1.4.1 // indirect
github.com/gofrs/uuid v3.1.0+incompatible // indirect
github.com/gogo/protobuf v1.2.0 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/protobuf v1.2.0
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/gomodule/redigo v2.0.0+incompatible
github.com/google/go-cmp v0.2.0 // indirect
github.com/google/uuid v1.0.0
github.com/gorilla/websocket v1.4.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
@@ -34,13 +29,11 @@ require (
github.com/imdario/mergo v0.3.7
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/infinimesh/mqtt-go v0.0.0-20190331134856-46f3ca3950fb
github.com/jeremywohl/flatten v0.0.0-20180923035001-588fe0d4c603
github.com/jinzhu/gorm v1.9.2
github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a // indirect
github.com/jinzhu/now v0.0.0-20181116074157-8ec929ed50c3 // indirect
github.com/julienschmidt/httprouter v1.2.0
github.com/lib/pq v1.0.0 // indirect
github.com/lib/pq v1.0.0
github.com/manifoldco/promptui v0.3.2
github.com/mattn/go-sqlite3 v1.10.0 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/nicksnyder/go-i18n v1.10.0 // indirect
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
18 go.sum
@@ -29,8 +29,6 @@ github.com/cskr/pubsub v1.0.1/go.mod h1:Sa0GZ6ObN+iL7BemRztT4twaIREPOG+9UXtWhOL/
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f h1:WH0w/R4Yoey+04HhFxqZ6VX6I0d7RMyw5aXQ9UTvQPs=
github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f/go.mod h1:xN/JuLBIz4bjkxNmByTiV1IbhfnYb6oo99phBn4Eqhc=
github.com/dgraph-io/dgo v0.0.0-20181226155115-a20f509ade83 h1:SZdDDO9by3j40EaPUyh1injjm+psL3KK7dOZWeNCVVo=
github.com/dgraph-io/dgo v0.0.0-20181226155115-a20f509ade83/go.mod h1:/3OtwVvGnHiyXL9bWTjZaHQk4cp8rakX6jVBFoykWaA=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
@@ -41,18 +39,12 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
github.com/evanphx/json-patch v4.1.0+incompatible h1:K1MDoo4AZ4wU0GIU/fPmtZg7VpzLjCxu+UwBD1FvwOc=
github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/gofrs/uuid v3.1.0+incompatible h1:q2rtkjaKT4YEr6E1kamy0Ha4RtepWlQBedyHx0uzKwA=
github.com/gofrs/uuid v3.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
@@ -67,8 +59,6 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pO
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf h1:7+FW5aGwISbqUtkfmIpZJGRgNFg2ioYPvFaUxdqpDsg=
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE=
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
@@ -93,12 +83,10 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/infinimesh/mqtt-go v0.0.0-20190331134856-46f3ca3950fb h1:dGawVY1NNPz1LFk3ct/8fUrQs7xrxciEsJf9XX3NI0Y=
github.com/infinimesh/mqtt-go v0.0.0-20190331134856-46f3ca3950fb/go.mod h1:NqGcsGR40ZGfBgLreBUOXIXe734K7/51QJbA3YxSijE=
github.com/jeremywohl/flatten v0.0.0-20180923035001-588fe0d4c603 h1:gSech9iGLFCosfl/DC7BWnpSSh/tQClWnKS2I2vdPww=
github.com/jeremywohl/flatten v0.0.0-20180923035001-588fe0d4c603/go.mod h1:4AmD/VxjWcI5SRB0n6szE2A6s2fsNHDLO0nAlMHgfLQ=
github.com/jinzhu/gorm v1.9.2 h1:lCvgEaqe/HVE+tjAR2mt4HbbHAZsQOv3XAZiEZV37iw=
github.com/jinzhu/gorm v1.9.2/go.mod h1:Vla75njaFJ8clLU1W44h34PjIkijhjHIYnZxMqCdxqo=
github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a h1:eeaG9XMUvRBYXJi4pg1ZKM7nxc5AfXfojeLLW7O5J3k=
github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v0.0.0-20181116074157-8ec929ed50c3 h1:xvj06l8iSwiWpYgm8MbPp+naBg+pwfqmdXabzqPCn/8=
github.com/jinzhu/now v0.0.0-20181116074157-8ec929ed50c3/go.mod h1:oHTiXerJ20+SfYcrdlBO7rzZRJWGwSTQ0iUY2jI6Gfc=
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU=
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU=
github.com/julienschmidt/httprouter v1.2.0 h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g=
@@ -123,8 +111,6 @@ github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRU
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I=
@@ -2,6 +2,7 @@ package timeseries

import (
"context"
"os"
"testing"
"time"

@@ -10,17 +11,27 @@ import (
)

var (
log *zap.Logger
log *zap.Logger
repo TimeseriesRepo
)

func init() {
log, _ = zap.NewDevelopment()

dbAddr := os.Getenv("TIMESERIES_URL")
if dbAddr == "" {
dbAddr = "postgres://postgres:postgres@localhost/postgres?sslmode=disable"
}

r, err := NewTimescaleRepo(log, dbAddr)
if err != nil {
panic(err)
}
repo = r
}

func TestSave(t *testing.T) {
repo, err := NewTimescaleRepo(log, "postgres://postgres:postgres@localhost/postgres?sslmode=disable")
require.NoError(t, err)
err = repo.CreateDataPoint(context.TODO(), &DataPoint{
err := repo.CreateDataPoint(context.TODO(), &DataPoint{
DeviceID: "test-device-1",
DeviceName: "test-device-1",
Property: "voltage",

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

0 comments on commit 79866ee

Please sign in to comment.
You can’t perform that action at this time.