Compare commits
No commits in common. "master" and "feat/http-server" have entirely different histories.
master
...
feat/http-
16
.SRCINFO
16
.SRCINFO
@ -1,16 +0,0 @@
|
|||||||
pkgbase = flucky
|
|
||||||
pkgdesc = A lightweight golang program to read values from different sensors
|
|
||||||
pkgver = 0.3.2
|
|
||||||
pkgrel = 2
|
|
||||||
url = https://git.cryptic.systems/flucky/flucky
|
|
||||||
arch = x86_64
|
|
||||||
arch = armv7h
|
|
||||||
license = Apache 2.0
|
|
||||||
makedepends = git
|
|
||||||
makedepends = go
|
|
||||||
makedepends = make
|
|
||||||
source = https://git.cryptic.systems/flucky/flucky/archive/v0.3.2.tar.gz
|
|
||||||
sha512sums = 1e53256f0b45c0e887b224ca697b3c1fadfb4135399595cbfee758f8f6c2357471da287a816d7fd0924adb96bc43676adf3149b0dd6bfa3f1c6c6947fcc6c760
|
|
||||||
|
|
||||||
pkgname = flucky
|
|
||||||
|
|
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
bin
|
78
.drone.yml
78
.drone.yml
@ -1,55 +1,41 @@
|
|||||||
---
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: kubernetes
|
type: docker
|
||||||
name: build
|
name: amd64
|
||||||
|
|
||||||
node_selector:
|
|
||||||
kubernetes.io/os: linux
|
|
||||||
kubernetes.io/arch: amd64
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-pkg
|
- name: build-linux-amd64
|
||||||
commands:
|
|
||||||
- makepkg --sign
|
|
||||||
environment:
|
|
||||||
MAKEPKG_PACKAGER: "csrbot@cryptic.systems"
|
|
||||||
MAKEPKG_PKGEXT: ".pkg.tar.zst"
|
|
||||||
MAKEPKG_SRCEXT: ".src.tar.zst"
|
|
||||||
image: docker.io/volkerraschek/build-image:latest
|
image: docker.io/volkerraschek/build-image:latest
|
||||||
|
commands:
|
||||||
trigger:
|
- make
|
||||||
event:
|
when:
|
||||||
include:
|
event:
|
||||||
- pull_request
|
|
||||||
- push
|
- push
|
||||||
exclude:
|
- pull_request
|
||||||
- tag
|
- tag
|
||||||
|
|
||||||
---
|
# - name: golangci-lint
|
||||||
kind: pipeline
|
# image: docker.io/golangci/golangci-lint:v1.40.1-alpine
|
||||||
type: kubernetes
|
# commands:
|
||||||
name: deploy
|
# - golangci-lint run --concurrency $(nproc --ignore=1)
|
||||||
|
# when:
|
||||||
|
# event:
|
||||||
|
# - push
|
||||||
|
# - pull_request
|
||||||
|
|
||||||
node_selector:
|
# - name: gosec
|
||||||
kubernetes.io/os: linux
|
# image: docker.io/securego/gosec:v2.8.0
|
||||||
kubernetes.io/arch: amd64
|
# when:
|
||||||
|
# event:
|
||||||
|
# - push
|
||||||
|
# - pull_request
|
||||||
|
|
||||||
steps:
|
# steps:
|
||||||
- name: build-pkg
|
# - name: test-unit
|
||||||
commands:
|
# image: docker.io/volkerraschek/build-image:latest
|
||||||
- makepkg --sign
|
# commands:
|
||||||
- scp *.pkg.tar.zst* ${AUR_SERVER}:/${AUR_PATH}
|
# - make test/unit
|
||||||
environment:
|
# when:
|
||||||
MAKEPKG_PACKAGER: "csrbot@cryptic.systems"
|
# event:
|
||||||
MAKEPKG_PKGEXT: ".pkg.tar.zst"
|
# - push
|
||||||
MAKEPKG_SRCEXT: ".src.tar.zst"
|
# - pull_request
|
||||||
SSH_KEY:
|
# - tag
|
||||||
from_secret:
|
|
||||||
ssh_key
|
|
||||||
image: docker.io/volkerraschek/build-image:latest
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
include:
|
|
||||||
- pull_request
|
|
||||||
- push
|
|
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = false
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Makefile eol=lf
|
14
.gitignore
vendored
14
.gitignore
vendored
@ -1,4 +1,10 @@
|
|||||||
*
|
# absolute files
|
||||||
!.drone.yml
|
.env
|
||||||
!.gitignore
|
|
||||||
!PKGBUILD
|
flucky*
|
||||||
|
|
||||||
|
# directories
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# coverage files
|
||||||
|
coverage*
|
29
.golangci.yml
Normal file
29
.golangci.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
run:
|
||||||
|
skip-dirs:
|
||||||
|
- it
|
||||||
|
timeout: 10m
|
||||||
|
tests: true
|
||||||
|
|
||||||
|
linters:
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
# Default
|
||||||
|
- deadcode
|
||||||
|
- errcheck
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- staticcheck
|
||||||
|
- structcheck
|
||||||
|
- typecheck
|
||||||
|
- unused
|
||||||
|
- varcheck
|
||||||
|
|
||||||
|
# Additionally linters
|
||||||
|
- bodyclose
|
||||||
|
- misspell
|
||||||
|
- nilerr
|
||||||
|
- rowserrcheck
|
||||||
|
- sqlclosecheck
|
||||||
|
- unparam
|
||||||
|
- whitespace
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# ARGs
|
||||||
|
# ==================================
|
||||||
|
ARG BASE_IMAGE
|
||||||
|
ARG BUILD_IMAGE
|
||||||
|
ARG EXECUTABLE
|
||||||
|
ARG EXECUTABLE_TARGET
|
||||||
|
ARG GOPROXY
|
||||||
|
ARG GOPRIVATE
|
||||||
|
ARG VERSION
|
||||||
|
|
||||||
|
# BUILD
|
||||||
|
# ==================================
|
||||||
|
FROM ${BUILD_IMAGE} AS build
|
||||||
|
COPY . /workspace
|
||||||
|
ENV GOPROXY=${GOPROXY}
|
||||||
|
ENV GOPRIVATE=${GOPRIVATE}
|
||||||
|
RUN make ${EXECUTABLE_TARGET} VERSION=${VERSION}
|
||||||
|
|
||||||
|
# TARGET
|
||||||
|
# ==================================
|
||||||
|
FROM ${BASE_IMAGE}
|
||||||
|
COPY --from=build /workspace/${EXECUTABLE_TARGET} /usr/bin/${EXECUTABLE}
|
13
LICENSE
Normal file
13
LICENSE
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Copyright 2019 Markus Pesch
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
89
Makefile
Normal file
89
Makefile
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
VERSION?=$(shell git describe --abbrev=0)+$(shell date +'%Y%m%d%H%I%S')
|
||||||
|
|
||||||
|
EXECUTABLE:=flucky
|
||||||
|
|
||||||
|
DESTDIR?=
|
||||||
|
PREFIX?=/usr/local
|
||||||
|
|
||||||
|
# BINARIES
|
||||||
|
# ==============================================================================
|
||||||
|
all: ${EXECUTABLE}
|
||||||
|
|
||||||
|
${EXECUTABLE}:
|
||||||
|
CGO_ENABLED=1 \
|
||||||
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
|
GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||||
|
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
|
||||||
|
|
||||||
|
# COMPLETIONS
|
||||||
|
# ==============================================================================
|
||||||
|
${EXECUTABLE}.sh: ${EXECUTABLE}
|
||||||
|
${EXECUTABLE} completion bash > ${@}
|
||||||
|
|
||||||
|
${EXECUTABLE}.fish: ${EXECUTABLE}
|
||||||
|
${EXECUTABLE} completion fish > ${@}
|
||||||
|
|
||||||
|
${EXECUTABLE}.zsh: ${EXECUTABLE}
|
||||||
|
${EXECUTABLE} completion zsh > ${@}
|
||||||
|
|
||||||
|
# UN/INSTALL
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=install
|
||||||
|
install: ${EXECUTABLE} ${EXECUTABLE}.sh ${EXECUTABLE}.fish ${EXECUTABLE}.zsh
|
||||||
|
install --directory ${DESTDIR}${PREFIX}/bin
|
||||||
|
install --mode 755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
||||||
|
|
||||||
|
install --directory ${DESTDIR}/usr/lib/systemd/system
|
||||||
|
install --mode 644 systemd/${EXECUTABLE}.service ${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service
|
||||||
|
|
||||||
|
install --directory ${DESTDIR}${PREFIX}/share/bash-completion/completions/
|
||||||
|
install --mode 644 ${EXECUTABLE}.sh ${DESTDIR}${PREFIX}/share/bash-completion/completions/${EXECUTABLE}.sh
|
||||||
|
|
||||||
|
install --directory ${DESTDIR}${PREFIX}/fish/vendor_completions.d
|
||||||
|
install --mode 644 ${EXECUTABLE}.fish ${DESTDIR}${PREFIX}/fish/vendor_completions.d/${EXECUTABLE}.fish
|
||||||
|
|
||||||
|
install --directory ${DESTDIR}${PREFIX}/licenses/${EXECUTABLE}
|
||||||
|
install --mode 644 LICENSE ${DESTDIR}${PREFIX}/licenses/${EXECUTABLE}/LICENSE
|
||||||
|
|
||||||
|
PHONY+=uninstall
|
||||||
|
uninstall:
|
||||||
|
-rm --recursive --force \
|
||||||
|
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
|
||||||
|
${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service \
|
||||||
|
${DESTDIR}${PREFIX}/share/bash-completion/completions/${EXECUTABLE}.sh \
|
||||||
|
${DESTDIR}${PREFIX}/fish/vendor_completions.d/${EXECUTABLE}.fish \
|
||||||
|
${DESTDIR}${PREFIX}/licenses/${EXECUTABLE}/LICENSE
|
||||||
|
|
||||||
|
# CLEAN
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=clean
|
||||||
|
clean:
|
||||||
|
rm --force --recursive ${EXECUTABLE}* || true
|
||||||
|
|
||||||
|
# TEST
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=test/unit
|
||||||
|
test/unit:
|
||||||
|
go test -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 600s -count=1 ./pkg/...
|
||||||
|
|
||||||
|
PHONY+=test/coverage
|
||||||
|
test/coverage: test/unit
|
||||||
|
go tool cover -html=coverage.txt
|
||||||
|
|
||||||
|
# GOLANGCI-LINT
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=golangci-lint
|
||||||
|
golangci-lint:
|
||||||
|
golangci-lint run --concurrency=$(shell nproc)
|
||||||
|
|
||||||
|
# GOSEC
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=gosec
|
||||||
|
gosec:
|
||||||
|
gosec $(shell pwd)/...
|
||||||
|
|
||||||
|
# PHONY
|
||||||
|
# ==============================================================================
|
||||||
|
# Declare the contents of the PHONY variable as phony. We keep that information
|
||||||
|
# in a variable so we can use it in if_changed.
|
||||||
|
.PHONY: ${PHONY}
|
16
PKGBUILD
16
PKGBUILD
@ -1,16 +0,0 @@
|
|||||||
# Maintainer: Markus Pesch <markus.pesch@cryptic.systems>
|
|
||||||
|
|
||||||
pkgname=flucky
|
|
||||||
pkgver=0.3.2
|
|
||||||
pkgrel=2
|
|
||||||
pkgdesc='A lightweight golang program to read values from different sensors'
|
|
||||||
arch=('x86_64' 'armv7h')
|
|
||||||
url=https://git.cryptic.systems/flucky/flucky
|
|
||||||
license=('Apache 2.0')
|
|
||||||
makedepends=('git' 'go' 'make')
|
|
||||||
source=("https://git.cryptic.systems/flucky/flucky/archive/v${pkgver}.tar.gz")
|
|
||||||
sha512sums=('1e53256f0b45c0e887b224ca697b3c1fadfb4135399595cbfee758f8f6c2357471da287a816d7fd0924adb96bc43676adf3149b0dd6bfa3f1c6c6947fcc6c760')
|
|
||||||
|
|
||||||
package() {
|
|
||||||
make --directory ${srcdir}/${pkgname} DESTDIR=${pkgdir} PREFIX=/usr VERSION=${pkgver} install
|
|
||||||
}
|
|
86
README.md
Normal file
86
README.md
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# flucky
|
||||||
|
|
||||||
|
[![Build Status](https://drone.cryptic.systems/api/badges/volker.raschek/flucky/status.svg)](https://drone.cryptic.systems/volker.raschek/flucky)
|
||||||
|
[![Docker Pulls](https://img.shields.io/docker/pulls/volkerraschek/flucky)](https://hub.docker.com/r/volkerraschek/flucky)
|
||||||
|
|
||||||
|
Flucky is a lightweight program written in go for reading data from sensors, for
|
||||||
|
example with a banana or raspberry pi. In addition, flucky provides a REST-API
|
||||||
|
to receive from other flucky installations measured values. All received
|
||||||
|
measured values, no matter if they come directly from flucky or from a server
|
||||||
|
instance of flucky with the provided REST-API, can be stored into a database.
|
||||||
|
|
||||||
|
## Supported and planned sensors
|
||||||
|
|
||||||
|
| Name | Measured values | Supported |
|
||||||
|
| ------- | --------------------------------------- | --------- |
|
||||||
|
| BME280 | humidity, pressure, temperature | Yes |
|
||||||
|
| DHT11 | temperature | Yes |
|
||||||
|
| DHT22 | temperature | Yes |
|
||||||
|
| DS18B20 | temperature | Yes |
|
||||||
|
| SDS011 | fine dust | Planning |
|
||||||
|
|
||||||
|
## Supported and planned backends
|
||||||
|
|
||||||
|
| Backend | Supported |
|
||||||
|
| --------------- | --------------- |
|
||||||
|
| flucky | WIP |
|
||||||
|
| Logfile | CSV, JSON, XML |
|
||||||
|
| MySQL, MariaDB | Planning |
|
||||||
|
| PostgreSQL | Yes |
|
||||||
|
| SQLite | Planning |
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Flucky can be installed over multiple ways. For example over a specific linux
|
||||||
|
distributions package or as container. The following table lists all
|
||||||
|
repositories where flucky can be otained from, but flucky can already be
|
||||||
|
compiled from source code.
|
||||||
|
|
||||||
|
| Distribution | Repo's |
|
||||||
|
| --------------------------- | ------------------------------------------------------------------------------------------- |
|
||||||
|
| Arch Linux | [armv7](https://arch.cryptic.systems/armv7), [x86_64](https://arch.cryptic.systems/x86_64) |
|
||||||
|
| Debian, Ubuntu, Linux Mint | Currently not supported |
|
||||||
|
| RHEL, Fedora, Centos | Planning |
|
||||||
|
| Container Image | [hub.docker.com](https://hub.docker.com/repository/docker/volkerraschek/flucky) |
|
||||||
|
|
||||||
|
### Compiling the source code
|
||||||
|
|
||||||
|
An additional ways to install flucky is to compile the source code. There are
|
||||||
|
two different ways to compile flucky from scratch. The easier ways is to use the
|
||||||
|
pre-defined container image, which has included all dependencies to compile
|
||||||
|
flucky. Alternatively, if all dependencies are met, flucky can also be compiled
|
||||||
|
without the container image. Both variants are briefly described.
|
||||||
|
|
||||||
|
#### Compiling the source code via container image
|
||||||
|
|
||||||
|
To compile flucky via container image it's necessary, that a container runtime
|
||||||
|
is installed. In the `Makefile` is predefined docker, but it's can be also used
|
||||||
|
podman. Execute `make container-run/flucky` to start the compiling process.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ make container-run/flucky
|
||||||
|
make container-run COMMAND=flucky
|
||||||
|
make[1]: Directory „/home/markus/workspace/flucky“ is entered
|
||||||
|
/usr/bin/docker run \
|
||||||
|
--rm \
|
||||||
|
--volume /home/markus/workspace/flucky:/workspace \
|
||||||
|
volkerraschek/build-image:latest \
|
||||||
|
make go-build \
|
||||||
|
VERSION=60ee044-git \
|
||||||
|
GOOS=linux \
|
||||||
|
GOARCH=amd64
|
||||||
|
go-bindata -pkg db -o ./pkg/db/bindataSQL.go ./pkg/db/sql/***
|
||||||
|
go-bindata -pkg goldenfiles -o ./test/goldenfiles/bindata.go ./test/goldenfiles/json/***
|
||||||
|
GOOS=linux \
|
||||||
|
GOARCH=amd64 \
|
||||||
|
go build -ldflags "-X main.version=60ee044-git"
|
||||||
|
go: finding github.com/spf13/pflag v1.0.3
|
||||||
|
go: finding github.com/satori/go.uuid v1.2.0
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Compiling the source code without container image
|
||||||
|
|
||||||
|
Make sure you have installed go >= v1.12. Execute `make flucky` to compile
|
||||||
|
flucky without a container-image. There should be a similar output as when
|
||||||
|
compiling flucky via the container image.
|
34
cli/completion/completion.go
Normal file
34
cli/completion/completion.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package completion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InitCmd initialize all daemon subcommands
|
||||||
|
func InitCmd(cmd *cobra.Command) error {
|
||||||
|
completionCmd := &cobra.Command{
|
||||||
|
Use: "completion",
|
||||||
|
Short: "Generate completion script",
|
||||||
|
Example: "flucky completion [bash|zsh|fish]",
|
||||||
|
ValidArgs: []string{"bash", "zsh", "fish"},
|
||||||
|
Args: cobra.ExactValidArgs(1),
|
||||||
|
RunE: run,
|
||||||
|
}
|
||||||
|
cmd.AddCommand(completionCmd)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func run(cmd *cobra.Command, args []string) error {
|
||||||
|
switch args[0] {
|
||||||
|
case "bash":
|
||||||
|
return cmd.Root().GenBashCompletion(os.Stdout)
|
||||||
|
case "zsh":
|
||||||
|
return cmd.Root().GenZshCompletion(os.Stdout)
|
||||||
|
case "fish":
|
||||||
|
return cmd.Root().GenFishCompletion(os.Stdout, true)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
51
cli/daemon/daemon.go
Normal file
51
cli/daemon/daemon.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package daemon
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/config"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/daemon"
|
||||||
|
"git.cryptic.systems/volker.raschek/go-logger"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InitCmd initialize all daemon subcommands
|
||||||
|
func InitCmd(cmd *cobra.Command) error {
|
||||||
|
daemonCmd := &cobra.Command{
|
||||||
|
Use: "daemon",
|
||||||
|
Short: "Read continuously data from all enabled sensors",
|
||||||
|
Example: "flucky daemon",
|
||||||
|
RunE: run,
|
||||||
|
}
|
||||||
|
|
||||||
|
daemonCmd.Flags().Uint("cached-values", 500, "Number of measured values in the cache before they are stored in the database")
|
||||||
|
cmd.AddCommand(daemonCmd)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func run(cmd *cobra.Command, args []string) error {
|
||||||
|
configFile, err := cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No config file defined: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
cachedEntries, err := cmd.Flags().GetUint("cached-values")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No cached-entries defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
// logLevel, err := cmd.Flags().GetString("loglevel")
|
||||||
|
// if err != nil {
|
||||||
|
// return fmt.Errorf("No loglevel defined: %v", err)
|
||||||
|
// }
|
||||||
|
|
||||||
|
flogger := logger.NewLogger(logger.LogLevelDebug)
|
||||||
|
|
||||||
|
cnf, err := config.Read(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return daemon.Start(cnf, cachedEntries, flogger)
|
||||||
|
}
|
86
cli/imp/imp.go
Normal file
86
cli/imp/imp.go
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
package imp
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/config"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/repository"
|
||||||
|
"git.cryptic.systems/volker.raschek/go-logger"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitCmd(cmd *cobra.Command) error {
|
||||||
|
importCmd := &cobra.Command{
|
||||||
|
Use: "import",
|
||||||
|
Args: cobra.RangeArgs(1, 2),
|
||||||
|
Short: "Import data from passed URL",
|
||||||
|
Example: `import sqlite3:///var/cache/flucky/sqlite3.db
|
||||||
|
import sqlite3:///var/cache/flucky/sqlite3.db postgres://user:password@host:port/database?sslmode=disable`,
|
||||||
|
RunE: importSources,
|
||||||
|
}
|
||||||
|
cmd.AddCommand(importCmd)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func importSources(cmd *cobra.Command, args []string) error {
|
||||||
|
configFile, err := cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No config file defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
cnf, err := config.Read(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logLevelString, err := cmd.Flags().GetString("loglevel")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logLevel, err := logger.ParseLogLevel(logLevelString)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
flogger := logger.NewLogger(logLevel)
|
||||||
|
|
||||||
|
var (
|
||||||
|
srcURL *url.URL
|
||||||
|
destURL *url.URL
|
||||||
|
)
|
||||||
|
|
||||||
|
srcURL, err = url.Parse(args[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
switch len(args) {
|
||||||
|
case 1:
|
||||||
|
destURL, err = url.Parse(cnf.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
destURL, err = url.Parse(args[1])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
srcRepository, err := repository.New(srcURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
destRepository, err := repository.New(destURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return destRepository.Import(context.Background(), srcRepository)
|
||||||
|
}
|
126
cli/root.go
Normal file
126
cli/root.go
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
"os"
|
||||||
|
"os/user"
|
||||||
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/cli/completion"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/cli/daemon"
|
||||||
|
imp "git.cryptic.systems/volker.raschek/flucky/cli/imp"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/cli/sensor"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/cli/temperature"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/config"
|
||||||
|
|
||||||
|
uuid "github.com/satori/go.uuid"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Execute a
|
||||||
|
func Execute(version string) error {
|
||||||
|
rootCmd := &cobra.Command{
|
||||||
|
Use: "flucky",
|
||||||
|
PersistentPreRunE: preRunError,
|
||||||
|
Version: version,
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfigFile, err := getDefaultConfigFile()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
rootCmd.PersistentFlags().String("config", defaultConfigFile, "Config file")
|
||||||
|
rootCmd.PersistentFlags().String("loglevel", "info", "Set the Loglevel. Possible values: debug, info, warn, error, fatal")
|
||||||
|
|
||||||
|
subCommands := []func(cmd *cobra.Command) error{
|
||||||
|
completion.InitCmd,
|
||||||
|
daemon.InitCmd,
|
||||||
|
imp.InitCmd,
|
||||||
|
sensor.InitCmd,
|
||||||
|
temperature.InitCmd,
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, subCommand := range subCommands {
|
||||||
|
if err := subCommand(rootCmd); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = rootCmd.Execute()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func preRunError(cmd *cobra.Command, args []string) error {
|
||||||
|
configFile := cmd.Flag("config").Value.String()
|
||||||
|
|
||||||
|
// check if config file exists
|
||||||
|
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
||||||
|
// Time must be truncated for postgres. Postgres currently does not support
|
||||||
|
// nanoseconds which is automatically include into the go time object
|
||||||
|
postgresTimeStamp := time.Now()
|
||||||
|
location, err := time.LoadLocation("Europe/Berlin")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
postgresTimeStamp = time.Date(postgresTimeStamp.Year(), postgresTimeStamp.Month(), postgresTimeStamp.Day(), postgresTimeStamp.Hour(), postgresTimeStamp.Minute(), postgresTimeStamp.Second(), int(math.Round(float64(postgresTimeStamp.Nanosecond())/1000000)*1000000), location)
|
||||||
|
|
||||||
|
// default cache directory
|
||||||
|
defaultCacheDir, err := getDefaultCacheDir()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default configuration
|
||||||
|
dsn := fmt.Sprintf("sqlite3://%v/sqlite.db?cache=shared&mode=memory&foreign_keys=on", defaultCacheDir)
|
||||||
|
cnf := config.Config{
|
||||||
|
DeviceID: uuid.NewV4().String(),
|
||||||
|
DSN: dsn,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = config.Write(&cnf, configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// getDefaultConfigFile returns the default path to the configuration file of
|
||||||
|
// flucky
|
||||||
|
func getDefaultConfigFile() (string, error) {
|
||||||
|
u, err := user.Current()
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Can not read current user: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch u.Uid {
|
||||||
|
case "0":
|
||||||
|
return "/etc/flucky/config.json", nil
|
||||||
|
default:
|
||||||
|
return filepath.Join(u.HomeDir, ".config/flucky/config.json"), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// getDefaultCacheDir returns the default path to the cache directory where
|
||||||
|
// flucky stores his measured values.
|
||||||
|
func getDefaultCacheDir() (string, error) {
|
||||||
|
u, err := user.Current()
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Can not read current user: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch u.Uid {
|
||||||
|
case "0":
|
||||||
|
return "/var/cache/flucky", nil
|
||||||
|
default:
|
||||||
|
return filepath.Join(u.HomeDir, ".cache/flucky"), nil
|
||||||
|
}
|
||||||
|
}
|
407
cli/sensor/sensor.go
Normal file
407
cli/sensor/sensor.go
Normal file
@ -0,0 +1,407 @@
|
|||||||
|
package sensor
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/cli"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/config"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/repository"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/types"
|
||||||
|
"git.cryptic.systems/volker.raschek/go-logger"
|
||||||
|
uuid "github.com/satori/go.uuid"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InitCmd initialize all sensor subcommands
|
||||||
|
func InitCmd(cmd *cobra.Command) error {
|
||||||
|
sensorCmd := &cobra.Command{
|
||||||
|
Use: "sensor",
|
||||||
|
Short: "Manage Sensors",
|
||||||
|
}
|
||||||
|
|
||||||
|
addSensorCmd := &cobra.Command{
|
||||||
|
Use: "add",
|
||||||
|
Short: "Add Sensor",
|
||||||
|
Aliases: []string{"append"},
|
||||||
|
Args: cobra.ExactArgs(2),
|
||||||
|
Example: `flucky sensor add --gpio GPIO14 indoor DHT11
|
||||||
|
flucky sensor add --wire-id 28-011432f0bb3d outdoor DS18B20
|
||||||
|
flucky sensor add --i2c-bus 1 --i2c-address 0x76 wetter-station BME280`,
|
||||||
|
RunE: addSensor,
|
||||||
|
}
|
||||||
|
addSensorCmd.Flags().Bool("enabled", true, "Enable new sensor")
|
||||||
|
addSensorCmd.Flags().String("gpio", "", "Defines the GPIO port")
|
||||||
|
addSensorCmd.Flags().Uint8("i2c-address", 0, "Defines the I2C address on the I2C bus")
|
||||||
|
addSensorCmd.Flags().Int("i2c-bus", 0, "Defines the I2C bus")
|
||||||
|
addSensorCmd.Flags().String("location", "", "Location of the sensor")
|
||||||
|
addSensorCmd.Flags().String("tick-duration", "1m", "Specifies how often measured values should be read from the sensor")
|
||||||
|
addSensorCmd.Flags().String("wire-id", "", "Defines the Wire-ID")
|
||||||
|
|
||||||
|
disableSensorCmd := &cobra.Command{
|
||||||
|
Use: "disable",
|
||||||
|
Short: "Disable Sensor",
|
||||||
|
Args: cobra.MinimumNArgs(1),
|
||||||
|
Example: "flucky sensor disable outdoor",
|
||||||
|
RunE: disableSensor,
|
||||||
|
}
|
||||||
|
|
||||||
|
enableSensorCmd := &cobra.Command{
|
||||||
|
Use: "enable",
|
||||||
|
Short: "Enable Sensor",
|
||||||
|
Example: "flucky sensor enable outdoor",
|
||||||
|
Args: cobra.MinimumNArgs(1),
|
||||||
|
RunE: enableSensor,
|
||||||
|
}
|
||||||
|
|
||||||
|
listSensorCmd := &cobra.Command{
|
||||||
|
Use: "list",
|
||||||
|
Short: "List Sensors",
|
||||||
|
Aliases: []string{"ls"},
|
||||||
|
RunE: listSensors,
|
||||||
|
}
|
||||||
|
|
||||||
|
removeSensorCmd := &cobra.Command{
|
||||||
|
Use: "remove",
|
||||||
|
Short: "Remove Sensor",
|
||||||
|
Aliases: []string{"rm"},
|
||||||
|
Example: "flucky sensor remove outdoor",
|
||||||
|
Args: cobra.MinimumNArgs(1),
|
||||||
|
RunE: removeSensor,
|
||||||
|
}
|
||||||
|
|
||||||
|
renameSensorCmd := &cobra.Command{
|
||||||
|
Use: "rename",
|
||||||
|
Short: "Rename Sensor",
|
||||||
|
Args: cobra.ExactArgs(2),
|
||||||
|
Example: `flucky sensor rename indoor outdoor
|
||||||
|
flucky sensor rename f98b00ea-a9b2-4e00-924f-113859d0af2d outdoor`,
|
||||||
|
RunE: renameSensor,
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, subCommand := range []*cobra.Command{
|
||||||
|
addSensorCmd,
|
||||||
|
disableSensorCmd,
|
||||||
|
enableSensorCmd,
|
||||||
|
listSensorCmd,
|
||||||
|
removeSensorCmd,
|
||||||
|
renameSensorCmd,
|
||||||
|
} {
|
||||||
|
sensorCmd.AddCommand(subCommand)
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.AddCommand(sensorCmd)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func addSensor(cmd *cobra.Command, args []string) error {
|
||||||
|
sensor := &types.Sensor{
|
||||||
|
ID: uuid.NewV4().String(),
|
||||||
|
Name: args[0],
|
||||||
|
Model: args[1],
|
||||||
|
}
|
||||||
|
|
||||||
|
sensorLocation, err := cmd.Flags().GetString("location")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sensor.Location = sensorLocation
|
||||||
|
|
||||||
|
sensorEnabled, err := cmd.Flags().GetBool("enabled")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sensor.Enabled = sensorEnabled
|
||||||
|
|
||||||
|
sensorGPIO, err := cmd.Flags().GetString("gpio")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(sensorGPIO) > 0 {
|
||||||
|
sensor.GPIONumber = sensorGPIO
|
||||||
|
}
|
||||||
|
|
||||||
|
sensorI2CAddress, err := cmd.Flags().GetUint8("i2c-address")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if sensorI2CAddress > 0 {
|
||||||
|
sensor.I2CAddress = &sensorI2CAddress
|
||||||
|
}
|
||||||
|
|
||||||
|
sensorI2CBus, err := cmd.Flags().GetInt("i2c-bus")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if sensorI2CBus > 0 {
|
||||||
|
sensor.I2CBus = &sensorI2CBus
|
||||||
|
}
|
||||||
|
|
||||||
|
sensorTickDuration, err := cmd.Flags().GetString("tick-duration")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sensor.TickDuration = sensorTickDuration
|
||||||
|
|
||||||
|
sensorWireID, err := cmd.Flags().GetString("wire-id")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(sensorWireID) > 0 {
|
||||||
|
sensor.WireID = &sensorWireID
|
||||||
|
}
|
||||||
|
|
||||||
|
configFile, err := cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No config file defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
cnf, err := config.Read(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
sensor.DeviceID = cnf.DeviceID
|
||||||
|
|
||||||
|
dsnURL, err := url.Parse(cnf.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// loglevel, err := cmd.Flags().GetString("loglevel")
|
||||||
|
// if err != nil {
|
||||||
|
// return fmt.Errorf("No loglevel defined")
|
||||||
|
// }
|
||||||
|
|
||||||
|
flogger := logger.NewLogger(logger.LogLevelDebug)
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// add sensor entry to list
|
||||||
|
err = repo.AddSensors(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// save new configuration
|
||||||
|
// err = config.Write(cnf, configFile)
|
||||||
|
// if err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func disableSensor(cmd *cobra.Command, args []string) error {
|
||||||
|
configFile, err := cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No config file defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
cnf, err := config.Read(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
dsnURL, err := url.Parse(cnf.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// loglevel, err := cmd.Flags().GetString("loglevel")
|
||||||
|
// if err != nil {
|
||||||
|
// return fmt.Errorf("No loglevel defined")
|
||||||
|
// }
|
||||||
|
|
||||||
|
flogger := logger.NewLogger(logger.LogLevelDebug)
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
s, err := repo.GetSensorsByNames(context.Background(), args...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := range s {
|
||||||
|
s[i].Enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.UpdateSensors(context.Background(), s...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func enableSensor(cmd *cobra.Command, args []string) error {
|
||||||
|
configFile, err := cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No config file defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
cnf, err := config.Read(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
dsnURL, err := url.Parse(cnf.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// loglevel, err := cmd.Flags().GetString("loglevel")
|
||||||
|
// if err != nil {
|
||||||
|
// return fmt.Errorf("No loglevel defined")
|
||||||
|
// }
|
||||||
|
|
||||||
|
flogger := logger.NewLogger(logger.LogLevelDebug)
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
s, err := repo.GetSensorsByNames(context.Background(), args...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := range s {
|
||||||
|
s[i].Enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.UpdateSensors(context.Background(), s...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func listSensors(cmd *cobra.Command, args []string) error {
|
||||||
|
configFile, err := cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No config file defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
cnf, err := config.Read(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
dsnURL, err := url.Parse(cnf.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// loglevel, err := cmd.Flags().GetString("loglevel")
|
||||||
|
// if err != nil {
|
||||||
|
// return fmt.Errorf("No loglevel defined")
|
||||||
|
// }
|
||||||
|
|
||||||
|
flogger := logger.NewLogger(logger.LogLevelDebug)
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// add sensor entry to list
|
||||||
|
sensors, err := repo.GetSensorsByDeviceIDs(context.Background(), cnf.DeviceID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = cli.PrintSensors(sensors, os.Stdout)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func removeSensor(cmd *cobra.Command, args []string) error {
|
||||||
|
configFile, err := cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No config file defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
cnf, err := config.Read(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
dsnURL, err := url.Parse(cnf.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// loglevel, err := cmd.Flags().GetString("loglevel")
|
||||||
|
// if err != nil {
|
||||||
|
// return fmt.Errorf("No loglevel defined")
|
||||||
|
// }
|
||||||
|
|
||||||
|
flogger := logger.NewLogger(logger.LogLevelDebug)
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return repo.RemoveSensorsByNames(context.Background(), args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func renameSensor(cmd *cobra.Command, args []string) error {
|
||||||
|
configFile, err := cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No config file defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
cnf, err := config.Read(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
dsnURL, err := url.Parse(cnf.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// loglevel, err := cmd.Flags().GetString("loglevel")
|
||||||
|
// if err != nil {
|
||||||
|
// return fmt.Errorf("No loglevel defined")
|
||||||
|
// }
|
||||||
|
|
||||||
|
flogger := logger.NewLogger(logger.LogLevelDebug)
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
s, err := repo.GetSensorsByNames(context.Background(), args[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := range s {
|
||||||
|
s[i].Name = args[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.UpdateSensors(context.Background(), s...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
131
cli/temperature/temperature.go
Normal file
131
cli/temperature/temperature.go
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
package temperature
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/cli"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/config"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/repository"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/sensor"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/types"
|
||||||
|
"git.cryptic.systems/volker.raschek/go-logger"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitCmd(cmd *cobra.Command) error {
|
||||||
|
temperatureCmd := &cobra.Command{
|
||||||
|
Use: "temperature",
|
||||||
|
Short: "Read and list temperature values",
|
||||||
|
}
|
||||||
|
|
||||||
|
readTemperatureCmd := &cobra.Command{
|
||||||
|
Use: "read",
|
||||||
|
Short: "Read temperature values from sensors",
|
||||||
|
RunE: readTemperature,
|
||||||
|
}
|
||||||
|
readTemperatureCmd.Flags().Bool("persist", true, "Persist measured values to the repository")
|
||||||
|
|
||||||
|
temperatureCmd.AddCommand(readTemperatureCmd)
|
||||||
|
cmd.AddCommand(temperatureCmd)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func readTemperature(cmd *cobra.Command, args []string) error {
|
||||||
|
configFile, err := cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("No config file defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
persist, err := cmd.Flags().GetBool("persist")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Flag persist not defined: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
cnf, err := config.Read(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
dsnURL, err := url.Parse(cnf.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logLevelString, err := cmd.Flags().GetString("loglevel")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
logLevel, err := logger.ParseLogLevel(logLevelString)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
flogger := logger.NewLogger(logLevel)
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
sensorTypes, err := repo.GetSensors(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
sensorTypes, err = types.FilterSensorByMeasuredValueTypes(sensorTypes, types.Temperature)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
sensors := make([]sensor.Sensor, 0)
|
||||||
|
for i := range sensorTypes {
|
||||||
|
s, err := sensor.New(sensorTypes[i])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sensors = append(sensors, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
measuredValueChannel, errorChannel := sensor.ReadPipeline(context.TODO(), sensors...)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
err, open := <-errorChannel
|
||||||
|
if !open {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
flogger.Error("%v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
measuredValues := make([]*types.MeasuredValue, 0)
|
||||||
|
LOOP:
|
||||||
|
for {
|
||||||
|
measuredValue, open := <-measuredValueChannel
|
||||||
|
if !open {
|
||||||
|
break LOOP
|
||||||
|
}
|
||||||
|
measuredValues = append(measuredValues, measuredValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = cli.PrintMeasuredValues(measuredValues, os.Stdout)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if persist {
|
||||||
|
err = repo.AddMeasuredValues(ctx, measuredValues...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
flucky-db:
|
||||||
|
container_name: postgres
|
||||||
|
environment:
|
||||||
|
- PGTZ=Europe/Berlin
|
||||||
|
- POSTGRES_PASSWORD=postgres
|
||||||
|
- TZ=Europe/Berlin
|
||||||
|
image: postgres:13-alpine
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
19
go.mod
Normal file
19
go.mod
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
module git.cryptic.systems/volker.raschek/flucky
|
||||||
|
|
||||||
|
go 1.16
|
||||||
|
|
||||||
|
require (
|
||||||
|
git.cryptic.systems/volker.raschek/dockerutils v0.2.0
|
||||||
|
git.cryptic.systems/volker.raschek/go-dht v0.1.2
|
||||||
|
git.cryptic.systems/volker.raschek/go-logger v0.1.0
|
||||||
|
github.com/d2r2/go-bsbmp v0.0.0-20190515110334-3b4b3aea8375
|
||||||
|
github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc
|
||||||
|
github.com/d2r2/go-logger v0.0.0-20181221090742-9998a510495e
|
||||||
|
github.com/golang-migrate/migrate/v4 v4.14.2-0.20201125065321-a53e6fc42574
|
||||||
|
github.com/johejo/golang-migrate-extra v0.0.0-20210217013041-51a992e50d16
|
||||||
|
github.com/lib/pq v1.10.2
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
||||||
|
github.com/satori/go.uuid v1.2.0
|
||||||
|
github.com/spf13/cobra v1.1.3
|
||||||
|
github.com/stretchr/testify v1.7.0
|
||||||
|
)
|
784
go.sum
Normal file
784
go.sum
Normal file
@ -0,0 +1,784 @@
|
|||||||
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||||
|
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
||||||
|
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||||
|
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
||||||
|
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
||||||
|
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
||||||
|
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
||||||
|
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
||||||
|
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
||||||
|
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
||||||
|
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||||
|
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
||||||
|
cloud.google.com/go v0.63.0/go.mod h1:GmezbQc7T2snqkEXWfZ0sy0VfkB/ivI2DdtJL2DEmlg=
|
||||||
|
cloud.google.com/go v0.64.0/go.mod h1:xfORb36jGvE+6EexW71nMEtL025s3x6xvuYUKM4JLv4=
|
||||||
|
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||||
|
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||||
|
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||||
|
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
||||||
|
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
||||||
|
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||||
|
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||||
|
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||||
|
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||||
|
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||||
|
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||||
|
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||||
|
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
||||||
|
cloud.google.com/go/spanner v1.9.0/go.mod h1:xvlEn0NZ5v1iJPYsBnUVRDNvccDxsBTEi16pJRKQVws=
|
||||||
|
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||||
|
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||||
|
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||||
|
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||||
|
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||||
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
|
git.cryptic.systems/volker.raschek/dockerutils v0.2.0 h1:HJhAfHoyKHOt76T5PxeLvpoA0FCiGu50u4GRwGLGVJs=
|
||||||
|
git.cryptic.systems/volker.raschek/dockerutils v0.2.0/go.mod h1:c4ZZpD2unnzwr7qHDpVdCmxLGOSnJagli7xNGgTBhk0=
|
||||||
|
git.cryptic.systems/volker.raschek/go-dht v0.1.2 h1:kGmfpaVUETQhSELCIrKXMjKwuUhQkRUz/7VbLYiTRJA=
|
||||||
|
git.cryptic.systems/volker.raschek/go-dht v0.1.2/go.mod h1:FUMwxa4cD+ATHPztXJntlO22I0DBTUPtXxfRF0JxXy8=
|
||||||
|
git.cryptic.systems/volker.raschek/go-logger v0.1.0 h1:JHBDesKBZaXjc2AlqYms1T3dGIX0oNIOBWl4cnVFWIo=
|
||||||
|
git.cryptic.systems/volker.raschek/go-logger v0.1.0/go.mod h1:GqeuxFj64SAolfj5kpbWup6E1vv37SaH5S+4wa40Tqs=
|
||||||
|
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
|
||||||
|
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
|
github.com/ClickHouse/clickhouse-go v1.3.12/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
|
||||||
|
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
|
||||||
|
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
|
||||||
|
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
|
||||||
|
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0=
|
||||||
|
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||||
|
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||||
|
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||||
|
github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||||
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
|
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
|
||||||
|
github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4=
|
||||||
|
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
|
||||||
|
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
|
||||||
|
github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||||
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||||
|
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||||
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||||
|
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||||
|
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||||
|
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
||||||
|
github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk=
|
||||||
|
github.com/containerd/containerd v1.4.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||||
|
github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||||
|
github.com/containerd/containerd v1.4.3 h1:ijQT13JedHSHrQGWFcGEwzcNKrAGIiZ+jSD5QQG07SY=
|
||||||
|
github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||||
|
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||||
|
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||||
|
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
|
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||||
|
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||||
|
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
|
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||||
|
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
|
github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
|
||||||
|
github.com/d2r2/go-bsbmp v0.0.0-20190515110334-3b4b3aea8375 h1:vdUOwcZdV+bBfGUUh5oPPWSzw9p+lBnNSuGgQwGpCH4=
|
||||||
|
github.com/d2r2/go-bsbmp v0.0.0-20190515110334-3b4b3aea8375/go.mod h1:3iz1WHlYJU9b4NJei+Q8G7DN3K05arcCMlOQ+qNCDjo=
|
||||||
|
github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc h1:HLRSIWzUGMLCq4ldt0W1GLs3nnAxa5EGoP+9qHgh6j0=
|
||||||
|
github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc/go.mod h1:AwxDPnsgIpy47jbGXZHA9Rv7pDkOJvQbezPuK1Y+nNk=
|
||||||
|
github.com/d2r2/go-logger v0.0.0-20181221090742-9998a510495e h1:ZG3JBA6rPRl0xxQ+nNSfO7tor8w+CNCTs05DNJQYbLM=
|
||||||
|
github.com/d2r2/go-logger v0.0.0-20181221090742-9998a510495e/go.mod h1:oA+9PUt8F1aKJ6o4YU1T120i7sgo1T6/1LWEEBy0BSs=
|
||||||
|
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-20200620013148-b91950f658ec/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
||||||
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
|
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||||
|
github.com/dhui/dktest v0.3.3 h1:DBuH/9GFaWbDRa42qsut/hbQu+srAQ0rPWnUoiGX7CA=
|
||||||
|
github.com/dhui/dktest v0.3.3/go.mod h1:EML9sP4sqJELHn4jV7B0TY8oF6077nk83/tz7M56jcQ=
|
||||||
|
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
|
||||||
|
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
|
github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
|
github.com/docker/docker v20.10.2+incompatible h1:vFgEHPqWBTp4pTjdLwjAA4bSo3gvIGOYwuJTlEjVBCw=
|
||||||
|
github.com/docker/docker v20.10.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
|
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
||||||
|
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
|
||||||
|
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
|
||||||
|
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||||
|
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||||
|
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||||
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw=
|
||||||
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
|
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||||
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
|
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
|
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM=
|
||||||
|
github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0=
|
||||||
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
|
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||||
|
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||||
|
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
|
github.com/golang-migrate/migrate/v4 v4.14.2-0.20201125065321-a53e6fc42574 h1:YEVMe8861NCZxTMzTI5BCobpwGpt1Md6D8v00jDc68w=
|
||||||
|
github.com/golang-migrate/migrate/v4 v4.14.2-0.20201125065321-a53e6fc42574/go.mod h1:l7Ks0Au6fYHuUIxUhQ0rcVX1uLlJg54C/VvW7tvxSz0=
|
||||||
|
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
|
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
|
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
|
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
|
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||||
|
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||||
|
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||||
|
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||||
|
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
||||||
|
github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
|
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
|
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||||
|
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||||
|
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||||
|
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
|
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
|
||||||
|
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
|
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
|
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
|
github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
|
||||||
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
|
||||||
|
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||||
|
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||||
|
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||||
|
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||||
|
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||||
|
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||||
|
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||||
|
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||||
|
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||||
|
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||||
|
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||||
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
|
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
|
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||||
|
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
|
||||||
|
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
|
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
|
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||||
|
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
||||||
|
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||||
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
|
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||||
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||||
|
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
|
||||||
|
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||||
|
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||||
|
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
|
||||||
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
|
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||||
|
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||||
|
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||||
|
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||||
|
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
|
||||||
|
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
||||||
|
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||||
|
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||||
|
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
|
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||||
|
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||||
|
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||||
|
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||||
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
|
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
|
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||||
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
|
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
|
||||||
|
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
|
||||||
|
github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
|
||||||
|
github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA=
|
||||||
|
github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE=
|
||||||
|
github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s=
|
||||||
|
github.com/jackc/pgconn v1.3.2/go.mod h1:LvCquS3HbBKwgl7KbX9KyqEIumJAbm1UMcTvGaIf3bM=
|
||||||
|
github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
|
||||||
|
github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
|
||||||
|
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||||
|
github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
|
||||||
|
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
|
||||||
|
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
|
||||||
|
github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
|
||||||
|
github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
|
||||||
|
github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||||
|
github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg=
|
||||||
|
github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc=
|
||||||
|
github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw=
|
||||||
|
github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y=
|
||||||
|
github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM=
|
||||||
|
github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc=
|
||||||
|
github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||||
|
github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||||
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||||
|
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
|
||||||
|
github.com/johejo/golang-migrate-extra v0.0.0-20210217013041-51a992e50d16 h1:sDjlyV4OzJYR2ZdLAAKZwV6N/CcX60xbGnPZzKJOZ50=
|
||||||
|
github.com/johejo/golang-migrate-extra v0.0.0-20210217013041-51a992e50d16/go.mod h1:lzH77MbyyahK7YO90wGRb65i9xLSoy2fD0dUSm23yMs=
|
||||||
|
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||||
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
|
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||||
|
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
|
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
|
||||||
|
github.com/k0kubun/pp v2.3.0+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
|
||||||
|
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
|
||||||
|
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||||
|
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||||
|
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
|
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||||
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4=
|
||||||
|
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
|
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
|
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
|
github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
|
github.com/lib/pq v1.9.0 h1:L8nSXQQzAYByakOFMTwpjRoHsMJklur4Gi59b6VivR8=
|
||||||
|
github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
|
github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
|
||||||
|
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
|
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
|
github.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI=
|
||||||
|
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
|
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||||
|
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||||
|
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
|
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
|
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||||
|
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
|
||||||
|
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
|
||||||
|
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||||
|
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 h1:rzf0wL0CHVc8CEsgyygG0Mn9CNCCPZqOPaz8RiiHYQk=
|
||||||
|
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
|
||||||
|
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
|
||||||
|
github.com/mutecomm/go-sqlcipher/v4 v4.4.0/go.mod h1:PyN04SaWalavxRGH9E8ZftG6Ju7rsPrGmQRjrEaVpiY=
|
||||||
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
|
github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA=
|
||||||
|
github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI=
|
||||||
|
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||||
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
|
github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
|
||||||
|
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||||
|
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||||
|
github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=
|
||||||
|
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||||
|
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||||
|
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||||
|
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
|
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||||
|
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||||
|
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||||
|
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
|
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||||
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
|
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||||
|
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
|
||||||
|
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
||||||
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||||
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
|
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||||
|
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
|
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||||
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
|
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||||
|
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
|
||||||
|
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
|
github.com/snowflakedb/glog v0.0.0-20180824191149-f5055e6f21ce/go.mod h1:EB/w24pR5VKI60ecFnKqXzxX3dOorz1rnVicQTQrGM0=
|
||||||
|
github.com/snowflakedb/gosnowflake v1.3.5/go.mod h1:13Ky+lxzIm3VqNDZJdyvu9MCGy+WgRdYFdXp96UcLZU=
|
||||||
|
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||||
|
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||||
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
|
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
|
github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4=
|
||||||
|
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
|
||||||
|
github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M=
|
||||||
|
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
|
||||||
|
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||||
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
|
||||||
|
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
|
github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||||
|
github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||||
|
github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs=
|
||||||
|
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
|
||||||
|
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
|
||||||
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
|
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||||
|
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE=
|
||||||
|
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
|
go.mongodb.org/mongo-driver v1.1.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
|
||||||
|
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||||
|
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||||
|
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
|
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
|
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
|
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||||
|
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||||
|
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||||
|
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||||
|
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||||
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||||
|
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||||
|
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||||
|
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||||
|
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||||
|
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||||
|
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||||
|
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||||
|
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||||
|
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||||
|
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||||
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
|
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||||
|
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||||
|
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||||
|
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||||
|
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||||
|
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||||
|
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||||
|
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||||
|
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||||
|
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190225153610-fe579d43d832/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
|
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
|
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
|
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
|
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
|
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
|
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
|
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
|
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/net v0.0.0-20201029221708-28c70e62bb1d/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew=
|
||||||
|
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201029080932-201ba4db2418/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
|
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE=
|
||||||
|
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||||
|
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||||
|
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||||
|
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||||
|
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
|
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
|
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
|
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
|
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
|
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||||
|
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||||
|
golang.org/x/tools v0.0.0-20200806022845-90696ccdc692/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||||
|
golang.org/x/tools v0.0.0-20200814230902-9882f1d1823d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||||
|
golang.org/x/tools v0.0.0-20200817023811-d00afeaade8f/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||||
|
golang.org/x/tools v0.0.0-20200818005847-188abfa75333/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||||
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||||
|
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||||
|
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||||
|
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||||
|
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||||
|
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||||
|
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||||
|
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||||
|
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||||
|
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||||
|
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||||
|
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||||
|
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||||
|
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||||
|
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||||
|
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||||
|
google.golang.org/appengine v1.0.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
|
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||||
|
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||||
|
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||||
|
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||||
|
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
||||||
|
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
||||||
|
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
||||||
|
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||||
|
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
||||||
|
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||||
|
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||||
|
google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||||
|
google.golang.org/genproto v0.0.0-20200815001618-f69a88009b70/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||||
|
google.golang.org/genproto v0.0.0-20200911024640-645f7a48b24f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||||
|
google.golang.org/genproto v0.0.0-20201030142918-24207fddd1c3 h1:sg8vLDNIxFPHTchfhH1E3AI32BL3f23oie38xUWnJM8=
|
||||||
|
google.golang.org/genproto v0.0.0-20201030142918-24207fddd1c3/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||||
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
|
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||||
|
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||||
|
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||||
|
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||||
|
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
|
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
|
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
|
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||||
|
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||||
|
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||||
|
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||||
|
google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||||
|
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||||
|
google.golang.org/grpc v1.35.0 h1:TwIQcH3es+MojMVojxxfQ3l3OF2KzlRxML2xZq0kRo8=
|
||||||
|
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||||
|
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||||
|
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||||
|
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
||||||
|
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
|
||||||
|
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||||
|
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
|
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
|
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||||
|
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||||
|
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||||
|
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
|
||||||
|
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
|
||||||
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||||
|
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||||
|
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||||
|
modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg=
|
||||||
|
modernc.org/db v1.0.0/go.mod h1:kYD/cO29L/29RM0hXYl4i3+Q5VojL31kTUVpVJDw0s8=
|
||||||
|
modernc.org/file v1.0.0/go.mod h1:uqEokAEn1u6e+J45e54dsEA/pw4o7zLrA2GwyntZzjw=
|
||||||
|
modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8=
|
||||||
|
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
|
||||||
|
modernc.org/internal v1.0.0/go.mod h1:VUD/+JAkhCpvkUitlEOnhpVxCgsBI90oTzSCRcqQVSM=
|
||||||
|
modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8=
|
||||||
|
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
||||||
|
modernc.org/ql v1.0.0/go.mod h1:xGVyrLIatPcO2C1JvI/Co8c0sr6y91HKFNy4pt9JXEY=
|
||||||
|
modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1k=
|
||||||
|
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
|
||||||
|
modernc.org/zappy v1.0.0/go.mod h1:hHe+oGahLVII/aTTyWK/b53VDHMAGCBYYeZ9sn83HC4=
|
||||||
|
periph.io/x/periph v3.6.4+incompatible h1:8FyXTbu9lcMVofz8mf+cj1pzTLN4V6EuPY2EF+DoJF4=
|
||||||
|
periph.io/x/periph v3.6.4+incompatible/go.mod h1:EWr+FCIU2dBWz5/wSWeiIUJTriYv9v2j2ENBmgYyy7Y=
|
||||||
|
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||||
|
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||||
|
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
23
main.go
Normal file
23
main.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/cli"
|
||||||
|
|
||||||
|
_ "github.com/golang-migrate/migrate/v4/database/postgres"
|
||||||
|
_ "github.com/golang-migrate/migrate/v4/database/sqlite3"
|
||||||
|
_ "github.com/lib/pq"
|
||||||
|
_ "github.com/mattn/go-sqlite3"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
version string
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
err := cli.Execute(version)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}
|
68
pkg/cli/cli.go
Normal file
68
pkg/cli/cli.go
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"text/tabwriter"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PrintMeasuredValues(measuredValues []*types.MeasuredValue, w io.Writer) error {
|
||||||
|
// declar tabwriter
|
||||||
|
tw := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0)
|
||||||
|
|
||||||
|
fmt.Fprint(tw, "timestamp\ttype\tvalue\n")
|
||||||
|
|
||||||
|
for i := range measuredValues {
|
||||||
|
fmt.Fprintf(tw, "%v\t%v\t%v\n", measuredValues[i].Date.String(), measuredValues[i].ValueType, measuredValues[i].Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
err := tw.Flush()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PrintSensors displays a list with all configured sensors
|
||||||
|
func PrintSensors(sensors []*types.Sensor, w io.Writer) error {
|
||||||
|
// declar tabwriter
|
||||||
|
tw := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0)
|
||||||
|
|
||||||
|
fmt.Fprint(tw, "name\tlocation\ttype\twire-id\ti2c-bus\ti2c-address\tgpio\ttick-duration\tenabled\n")
|
||||||
|
|
||||||
|
for _, sensor := range sensors {
|
||||||
|
fmt.Fprintf(tw, "%v\t%v\t%v\t", sensor.Name, sensor.Location, sensor.Model)
|
||||||
|
|
||||||
|
if sensor.WireID != nil {
|
||||||
|
fmt.Fprintf(tw, "%v\t", *sensor.WireID)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(tw, "\t")
|
||||||
|
}
|
||||||
|
|
||||||
|
if sensor.I2CBus != nil {
|
||||||
|
fmt.Fprintf(tw, "%v\t", *sensor.I2CBus)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(tw, "\t")
|
||||||
|
}
|
||||||
|
|
||||||
|
if sensor.I2CAddress != nil {
|
||||||
|
fmt.Fprintf(tw, "%#v\t", *sensor.I2CAddress)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(tw, "\t")
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Fprintf(tw, "%v\t", sensor.GPIONumber)
|
||||||
|
|
||||||
|
fmt.Fprintf(tw, "%v\t%v\n", sensor.TickDuration, sensor.Enabled)
|
||||||
|
}
|
||||||
|
|
||||||
|
err := tw.Flush()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
7
pkg/config/config.go
Normal file
7
pkg/config/config.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
// Config represent the configuration
|
||||||
|
type Config struct {
|
||||||
|
DeviceID string `json:"device_id"`
|
||||||
|
DSN string `json:"dsn"`
|
||||||
|
}
|
62
pkg/config/io.go
Normal file
62
pkg/config/io.go
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Decode a configuration from a reader
|
||||||
|
func Decode(r io.Reader) (*Config, error) {
|
||||||
|
cnf := new(Config)
|
||||||
|
jsonDecoder := json.NewDecoder(r)
|
||||||
|
if err := jsonDecoder.Decode(&cnf); err != nil {
|
||||||
|
return nil, fmt.Errorf("Can not unmarshal JSON: %v", err)
|
||||||
|
}
|
||||||
|
return cnf, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode a configuration to a writer
|
||||||
|
func Encode(cnf *Config, w io.Writer) error {
|
||||||
|
encoder := json.NewEncoder(w)
|
||||||
|
encoder.SetIndent("", " ")
|
||||||
|
err := encoder.Encode(cnf)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error encoding config to json: %v", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the configuration file
|
||||||
|
func Read(configFile string) (*Config, error) {
|
||||||
|
/* #nosec */
|
||||||
|
f, err := os.Open(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Can not open file %v: %v", configFile, err)
|
||||||
|
}
|
||||||
|
defer func() { _ = f.Close() }()
|
||||||
|
|
||||||
|
return Decode(f)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write the configuration into a file, specified by the configuration filepath
|
||||||
|
func Write(cnf *Config, configFile string) error {
|
||||||
|
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
||||||
|
configDir := filepath.Dir(configFile)
|
||||||
|
/* #nosec */
|
||||||
|
err := os.MkdirAll(configDir, 0775)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Failed to create config directory %v: %v", configDir, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f, err := os.Create(configFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Failed not create config file %v: %v", configFile, err)
|
||||||
|
}
|
||||||
|
defer func() { _ = f.Close() }()
|
||||||
|
|
||||||
|
return Encode(cnf, f)
|
||||||
|
}
|
143
pkg/daemon/daemon.go
Normal file
143
pkg/daemon/daemon.go
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
package daemon
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/config"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/repository"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/sensor"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/types"
|
||||||
|
"git.cryptic.systems/volker.raschek/go-logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Start(cnf *config.Config, cachedEntries uint, flogger logger.Logger) error {
|
||||||
|
// load data source name (dsn)
|
||||||
|
dsnURL, err := url.Parse(cnf.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, flogger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
// Add
|
||||||
|
repoDevice, err := repo.GetDeviceByID(ctx, cnf.DeviceID)
|
||||||
|
switch {
|
||||||
|
case err != nil:
|
||||||
|
return err
|
||||||
|
case repoDevice == nil:
|
||||||
|
|
||||||
|
hostname, err := os.Hostname()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.AddDevices(ctx, &types.Device{
|
||||||
|
ID: cnf.DeviceID,
|
||||||
|
Name: hostname,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
repoDevice, err = repo.GetDeviceByID(ctx, cnf.DeviceID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repoSensors, err := repo.GetSensorsByDeviceIDs(ctx, repoDevice.ID)
|
||||||
|
switch {
|
||||||
|
case err != nil:
|
||||||
|
return err
|
||||||
|
case repoSensors == nil, len(repoSensors) <= 0:
|
||||||
|
return fmt.Errorf("No sensors found")
|
||||||
|
}
|
||||||
|
|
||||||
|
sensors := make([]sensor.Sensor, 0)
|
||||||
|
for _, repoSensor := range repoSensors {
|
||||||
|
if !repoSensor.Enabled || repoSensor.DeviceID != repoDevice.ID {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
flogger.Debug("Found sensor %v", repoSensor.Name)
|
||||||
|
|
||||||
|
sensor, err := sensor.New(repoSensor)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sensors = append(sensors, sensor)
|
||||||
|
}
|
||||||
|
|
||||||
|
interruptChannel := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(interruptChannel, syscall.SIGTERM)
|
||||||
|
|
||||||
|
// Collection
|
||||||
|
parentCtx := context.Background()
|
||||||
|
ctx, cancel := context.WithCancel(parentCtx)
|
||||||
|
|
||||||
|
measuredValueChannel, errorChannel := sensor.ReadTickingPipeline(ctx, sensors...)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
|
case err, open := <-errorChannel:
|
||||||
|
if !open {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
flogger.Error("%v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
measuredValues := make([]*types.MeasuredValue, 0, cachedEntries)
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case measuredValue := <-measuredValueChannel:
|
||||||
|
flogger.Debug("%v\t%v\t%v", measuredValue.ID, measuredValue.ValueType, measuredValue.Value)
|
||||||
|
measuredValues = append(measuredValues, measuredValue)
|
||||||
|
|
||||||
|
if cap(measuredValues) == len(measuredValues) {
|
||||||
|
flogger.Debug("Flush cache with %v values", len(measuredValues))
|
||||||
|
err := repo.AddMeasuredValues(ctx, measuredValues...)
|
||||||
|
if err != nil {
|
||||||
|
flogger.Error("%v", err)
|
||||||
|
}
|
||||||
|
measuredValues = make([]*types.MeasuredValue, 0, cachedEntries)
|
||||||
|
}
|
||||||
|
|
||||||
|
case signal := <-interruptChannel:
|
||||||
|
cancel()
|
||||||
|
|
||||||
|
flogger.Info("Stopping daemon: Received process signal %v", signal.String())
|
||||||
|
|
||||||
|
flogger.Debug("Flush cache with %v remaining values", len(measuredValues))
|
||||||
|
|
||||||
|
err := repo.AddMeasuredValues(ctx, measuredValues...)
|
||||||
|
if err != nil {
|
||||||
|
flogger.Error("%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
flogger.Debug("Close repository")
|
||||||
|
err = repo.Close()
|
||||||
|
if err != nil {
|
||||||
|
flogger.Error("%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
pkg/internal/format/format.go
Normal file
19
pkg/internal/format/format.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package format
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
TimeFormat = "2006-01-02T15:04:05.999999Z07:00"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FormatedTime returns a current timestamp without nano seconds. Postgres
|
||||||
|
// currently does not support nanoseconds which is automatically include into
|
||||||
|
// the go time object
|
||||||
|
func FormatedTime() time.Time {
|
||||||
|
t := time.Now()
|
||||||
|
l, _ := time.LoadLocation("Europe/Berlin")
|
||||||
|
return time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), int(math.Round(float64(t.Nanosecond())/1000000)*1000000), l)
|
||||||
|
}
|
1102
pkg/repository/postgres.go
Normal file
1102
pkg/repository/postgres.go
Normal file
File diff suppressed because it is too large
Load Diff
1
pkg/repository/postgres/ddl/1_table_devices.down.sql
Normal file
1
pkg/repository/postgres/ddl/1_table_devices.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE devices;
|
8
pkg/repository/postgres/ddl/1_table_devices.up.sql
Normal file
8
pkg/repository/postgres/ddl/1_table_devices.up.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
CREATE TABLE devices (
|
||||||
|
device_id CHAR(36) NOT NULL,
|
||||||
|
device_name VARCHAR(64) NOT NULL,
|
||||||
|
device_location VARCHAR(64),
|
||||||
|
creation_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
|
update_date TIMESTAMP WITH TIME ZONE,
|
||||||
|
CONSTRAINT pk_devices PRIMARY KEY(device_id)
|
||||||
|
);
|
1
pkg/repository/postgres/ddl/2_table_sensors.down.sql
Normal file
1
pkg/repository/postgres/ddl/2_table_sensors.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE sensors;
|
17
pkg/repository/postgres/ddl/2_table_sensors.up.sql
Normal file
17
pkg/repository/postgres/ddl/2_table_sensors.up.sql
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
CREATE TABLE sensors (
|
||||||
|
sensor_id CHAR(36) NOT NULL,
|
||||||
|
sensor_name VARCHAR(64) NOT NULL,
|
||||||
|
sensor_location VARCHAR(64),
|
||||||
|
wire_id VARCHAR(64),
|
||||||
|
i2c_bus VARCHAR(255),
|
||||||
|
i2c_address VARCHAR(12),
|
||||||
|
gpio_number VARCHAR(6),
|
||||||
|
sensor_model VARCHAR(16) NOT NULL,
|
||||||
|
sensor_enabled BOOLEAN DEFAULT TRUE NOT NULL,
|
||||||
|
tick_duration VARCHAR(6) NOT NULL,
|
||||||
|
device_id CHAR(36) NOT NULL,
|
||||||
|
creation_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
|
update_date TIMESTAMP WITH TIME ZONE,
|
||||||
|
CONSTRAINT pk_sensors PRIMARY KEY(sensor_id),
|
||||||
|
CONSTRAINT fk_sensors_device_id FOREIGN KEY (device_id) REFERENCES devices(device_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
1
pkg/repository/postgres/ddl/3_table_humidites.down.sql
Normal file
1
pkg/repository/postgres/ddl/3_table_humidites.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE humidities;
|
10
pkg/repository/postgres/ddl/3_table_humidites.up.sql
Normal file
10
pkg/repository/postgres/ddl/3_table_humidites.up.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
CREATE TABLE humidities (
|
||||||
|
id CHAR(36) NOT NULL,
|
||||||
|
value NUMERIC(10,3) NOT NULL,
|
||||||
|
date TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||||
|
sensor_id CHAR(36) NOT NULL,
|
||||||
|
creation_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
|
update_date TIMESTAMP WITH TIME ZONE,
|
||||||
|
CONSTRAINT pk_humidites PRIMARY KEY (id),
|
||||||
|
CONSTRAINT pk_humidites_sensor_id FOREIGN KEY(sensor_id) REFERENCES sensors(sensor_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
1
pkg/repository/postgres/ddl/4_table_pressures.down.sql
Normal file
1
pkg/repository/postgres/ddl/4_table_pressures.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE pressures;
|
10
pkg/repository/postgres/ddl/4_table_pressures.up.sql
Normal file
10
pkg/repository/postgres/ddl/4_table_pressures.up.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
CREATE TABLE pressures (
|
||||||
|
id CHAR(36) NOT NULL,
|
||||||
|
value NUMERIC(10,3) NOT NULL,
|
||||||
|
date TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||||
|
sensor_id CHAR(36) NOT NULL,
|
||||||
|
creation_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
|
update_date TIMESTAMP WITH TIME ZONE,
|
||||||
|
CONSTRAINT pk_pressures PRIMARY KEY(id),
|
||||||
|
CONSTRAINT pk_pressures_sensor_id FOREIGN KEY(sensor_id) REFERENCES sensors(sensor_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE temperatures;
|
10
pkg/repository/postgres/ddl/5_table_temperatures.up.sql
Normal file
10
pkg/repository/postgres/ddl/5_table_temperatures.up.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
CREATE TABLE temperatures (
|
||||||
|
id CHAR(36) NOT NULL,
|
||||||
|
value NUMERIC(10,3) NOT NULL,
|
||||||
|
date TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||||
|
sensor_id CHAR(36) NOT NULL,
|
||||||
|
creation_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
|
update_date TIMESTAMP WITH TIME ZONE,
|
||||||
|
CONSTRAINT pk_temperatures PRIMARY KEY (id),
|
||||||
|
CONSTRAINT fk_temperatures_sensor_id FOREIGN KEY (sensor_id) REFERENCES sensors(sensor_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE humidities
|
||||||
|
DROP CONSTRAINT fk_humidites_sensor_id;
|
||||||
|
|
||||||
|
ALTER TABLE humidities
|
||||||
|
ADD CONSTRAINT pk_humidites_sensor_id
|
||||||
|
FOREIGN KEY (sensor_id)
|
||||||
|
REFERENCES sensors(sensor_id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE humidities
|
||||||
|
DROP CONSTRAINT pk_humidites_sensor_id;
|
||||||
|
|
||||||
|
ALTER TABLE humidities
|
||||||
|
ADD CONSTRAINT fk_humidites_sensor_id
|
||||||
|
FOREIGN KEY (sensor_id)
|
||||||
|
REFERENCES sensors(sensor_id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE pressures
|
||||||
|
DROP CONSTRAINT fk_pressures_sensor_id;
|
||||||
|
|
||||||
|
ALTER TABLE pressures
|
||||||
|
ADD CONSTRAINT pk_pressures_sensor_id
|
||||||
|
FOREIGN KEY (sensor_id)
|
||||||
|
REFERENCES sensors(sensor_id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE pressures
|
||||||
|
DROP CONSTRAINT pk_pressures_sensor_id;
|
||||||
|
|
||||||
|
ALTER TABLE pressures
|
||||||
|
ADD CONSTRAINT fk_pressures_sensor_id
|
||||||
|
FOREIGN KEY (sensor_id)
|
||||||
|
REFERENCES sensors(sensor_id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
2
pkg/repository/postgres/dml/deleteDeviceByID.sql
Normal file
2
pkg/repository/postgres/dml/deleteDeviceByID.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DELETE FROM devices
|
||||||
|
WHERE device_id = $1;
|
2
pkg/repository/postgres/dml/deleteDeviceByName.sql
Normal file
2
pkg/repository/postgres/dml/deleteDeviceByName.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DELETE FROM devices
|
||||||
|
WHERE device_name = $1;
|
2
pkg/repository/postgres/dml/deleteSensorByID.sql
Normal file
2
pkg/repository/postgres/dml/deleteSensorByID.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DELETE FROM sensors
|
||||||
|
WHERE sensor_id = $1;
|
2
pkg/repository/postgres/dml/deleteSensorByName.sql
Normal file
2
pkg/repository/postgres/dml/deleteSensorByName.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DELETE FROM sensors
|
||||||
|
WHERE sensor_name = $1;
|
8
pkg/repository/postgres/dml/insertDevice.sql
Normal file
8
pkg/repository/postgres/dml/insertDevice.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
INSERT INTO devices (
|
||||||
|
device_id,
|
||||||
|
device_name,
|
||||||
|
device_location,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5);
|
9
pkg/repository/postgres/dml/insertHumidity.sql
Normal file
9
pkg/repository/postgres/dml/insertHumidity.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
INSERT INTO humidities (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6);
|
14
pkg/repository/postgres/dml/insertOrUpdateDevice.sql
Normal file
14
pkg/repository/postgres/dml/insertOrUpdateDevice.sql
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
INSERT INTO devices (
|
||||||
|
device_id,
|
||||||
|
device_name,
|
||||||
|
device_location,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5)
|
||||||
|
ON CONFLICT (device_id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
device_name = EXCLUDED.device_name,
|
||||||
|
device_location = EXCLUDED.device_location,
|
||||||
|
update_date = NOW();
|
16
pkg/repository/postgres/dml/insertOrUpdateHumidity.sql
Normal file
16
pkg/repository/postgres/dml/insertOrUpdateHumidity.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INSERT INTO humidities (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
|
ON CONFLICT (id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
value = EXCLUDED.value,
|
||||||
|
date = EXCLUDED.date,
|
||||||
|
sensor_id = EXCLUDED.sensor_id,
|
||||||
|
update_date = NOW();
|
16
pkg/repository/postgres/dml/insertOrUpdatePressure.sql
Normal file
16
pkg/repository/postgres/dml/insertOrUpdatePressure.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INSERT INTO pressures (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
|
ON CONFLICT (id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
value = EXCLUDED.value,
|
||||||
|
date = EXCLUDED.date,
|
||||||
|
sensor_id = EXCLUDED.sensor_id,
|
||||||
|
update_date = NOW();
|
31
pkg/repository/postgres/dml/insertOrUpdateSensor.sql
Normal file
31
pkg/repository/postgres/dml/insertOrUpdateSensor.sql
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
INSERT INTO sensors (
|
||||||
|
sensor_id,
|
||||||
|
sensor_name,
|
||||||
|
sensor_location,
|
||||||
|
wire_id,
|
||||||
|
i2c_bus,
|
||||||
|
i2c_address,
|
||||||
|
gpio_number,
|
||||||
|
sensor_model,
|
||||||
|
sensor_enabled,
|
||||||
|
tick_duration,
|
||||||
|
device_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
|
||||||
|
ON CONFLICT (sensor_id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
sensor_name = EXCLUDED.sensor_name,
|
||||||
|
sensor_location = EXCLUDED.sensor_location,
|
||||||
|
wire_id = EXCLUDED.wire_id,
|
||||||
|
i2c_bus = EXCLUDED.i2c_bus,
|
||||||
|
i2c_address = EXCLUDED.i2c_address,
|
||||||
|
gpio_number = EXCLUDED.gpio_number,
|
||||||
|
sensor_model = EXCLUDED.sensor_model,
|
||||||
|
sensor_enabled = EXCLUDED.sensor_enabled,
|
||||||
|
tick_duration = EXCLUDED.tick_duration,
|
||||||
|
device_id = EXCLUDED.device_id,
|
||||||
|
creation_date = EXCLUDED.creation_date,
|
||||||
|
update_date = NOW();
|
16
pkg/repository/postgres/dml/insertOrUpdateTemperature.sql
Normal file
16
pkg/repository/postgres/dml/insertOrUpdateTemperature.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INSERT INTO temperatures (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
|
ON CONFLICT (id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
value = EXCLUDED.value,
|
||||||
|
date = EXCLUDED.date,
|
||||||
|
sensor_id = EXCLUDED.sensor_id,
|
||||||
|
update_date = NOW();
|
9
pkg/repository/postgres/dml/insertPressure.sql
Normal file
9
pkg/repository/postgres/dml/insertPressure.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
INSERT INTO pressures (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6);
|
16
pkg/repository/postgres/dml/insertSensor.sql
Normal file
16
pkg/repository/postgres/dml/insertSensor.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INSERT INTO sensors (
|
||||||
|
sensor_id,
|
||||||
|
sensor_name,
|
||||||
|
sensor_location,
|
||||||
|
wire_id,
|
||||||
|
i2c_bus,
|
||||||
|
i2c_address,
|
||||||
|
gpio_number,
|
||||||
|
sensor_model,
|
||||||
|
sensor_enabled,
|
||||||
|
tick_duration,
|
||||||
|
device_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13);
|
9
pkg/repository/postgres/dml/insertTemperature.sql
Normal file
9
pkg/repository/postgres/dml/insertTemperature.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
INSERT INTO temperatures (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6);
|
9
pkg/repository/postgres/dml/selectDeviceByID.sql
Normal file
9
pkg/repository/postgres/dml/selectDeviceByID.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
SELECT
|
||||||
|
device_id,
|
||||||
|
device_name,
|
||||||
|
device_location,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
devices
|
||||||
|
WHERE device_id = $1;
|
9
pkg/repository/postgres/dml/selectDeviceByName.sql
Normal file
9
pkg/repository/postgres/dml/selectDeviceByName.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
SELECT
|
||||||
|
device_id,
|
||||||
|
device_name,
|
||||||
|
device_location,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
devices
|
||||||
|
WHERE device_name = $1;
|
10
pkg/repository/postgres/dml/selectDevices.sql
Normal file
10
pkg/repository/postgres/dml/selectDevices.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
SELECT
|
||||||
|
device_id,
|
||||||
|
device_name,
|
||||||
|
device_location,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
devices
|
||||||
|
ORDER BY
|
||||||
|
device_id ASC;
|
9
pkg/repository/postgres/dml/selectHumidities.sql
Normal file
9
pkg/repository/postgres/dml/selectHumidities.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
humidities;
|
11
pkg/repository/postgres/dml/selectHumidityByID.sql
Normal file
11
pkg/repository/postgres/dml/selectHumidityByID.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
humidities
|
||||||
|
WHERE
|
||||||
|
id = $1
|
11
pkg/repository/postgres/dml/selectPressureByID.sql
Normal file
11
pkg/repository/postgres/dml/selectPressureByID.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
pressures
|
||||||
|
WHERE
|
||||||
|
id = $1
|
9
pkg/repository/postgres/dml/selectPressures.sql
Normal file
9
pkg/repository/postgres/dml/selectPressures.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
pressures;
|
20
pkg/repository/postgres/dml/selectSensorByID.sql
Normal file
20
pkg/repository/postgres/dml/selectSensorByID.sql
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
SELECT
|
||||||
|
sensor_id,
|
||||||
|
sensor_name,
|
||||||
|
sensor_location,
|
||||||
|
wire_id,
|
||||||
|
i2c_bus,
|
||||||
|
i2c_address,
|
||||||
|
gpio_number,
|
||||||
|
sensor_model,
|
||||||
|
sensor_enabled,
|
||||||
|
tick_duration,
|
||||||
|
device_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
sensors
|
||||||
|
WHERE
|
||||||
|
sensor_id = $1
|
||||||
|
ORDER BY
|
||||||
|
sensor_name ASC;
|
18
pkg/repository/postgres/dml/selectSensors.sql
Normal file
18
pkg/repository/postgres/dml/selectSensors.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
SELECT
|
||||||
|
sensor_id,
|
||||||
|
sensor_name,
|
||||||
|
sensor_location,
|
||||||
|
wire_id,
|
||||||
|
i2c_bus,
|
||||||
|
i2c_address,
|
||||||
|
gpio_number,
|
||||||
|
sensor_model,
|
||||||
|
sensor_enabled,
|
||||||
|
tick_duration,
|
||||||
|
device_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
sensors
|
||||||
|
ORDER BY
|
||||||
|
sensor_id ASC;
|
18
pkg/repository/postgres/dml/selectSensorsByDeviceID.sql
Normal file
18
pkg/repository/postgres/dml/selectSensorsByDeviceID.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
SELECT
|
||||||
|
sensor_id,
|
||||||
|
sensor_name,
|
||||||
|
sensor_location,
|
||||||
|
wire_id,
|
||||||
|
i2c_bus,
|
||||||
|
i2c_address,
|
||||||
|
gpio_number,
|
||||||
|
sensor_model,
|
||||||
|
sensor_enabled,
|
||||||
|
tick_duration,
|
||||||
|
device_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
sensors
|
||||||
|
WHERE
|
||||||
|
device_id = $1;
|
18
pkg/repository/postgres/dml/selectSensorsByModel.sql
Normal file
18
pkg/repository/postgres/dml/selectSensorsByModel.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
SELECT
|
||||||
|
sensor_id,
|
||||||
|
sensor_name,
|
||||||
|
sensor_location,
|
||||||
|
wire_id,
|
||||||
|
i2c_bus,
|
||||||
|
i2c_address,
|
||||||
|
gpio_number,
|
||||||
|
sensor_model,
|
||||||
|
sensor_enabled,
|
||||||
|
tick_duration,
|
||||||
|
device_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
sensors
|
||||||
|
WHERE
|
||||||
|
sensor_model = $1;
|
18
pkg/repository/postgres/dml/selectSensorsByName.sql
Normal file
18
pkg/repository/postgres/dml/selectSensorsByName.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
SELECT
|
||||||
|
sensor_id,
|
||||||
|
sensor_name,
|
||||||
|
sensor_location,
|
||||||
|
wire_id,
|
||||||
|
i2c_bus,
|
||||||
|
i2c_address,
|
||||||
|
gpio_number,
|
||||||
|
sensor_model,
|
||||||
|
sensor_enabled,
|
||||||
|
tick_duration,
|
||||||
|
device_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
sensors
|
||||||
|
WHERE
|
||||||
|
sensor_name = $1;
|
11
pkg/repository/postgres/dml/selectTemperatureByID.sql
Normal file
11
pkg/repository/postgres/dml/selectTemperatureByID.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
temperatures
|
||||||
|
WHERE
|
||||||
|
id = $1
|
9
pkg/repository/postgres/dml/selectTemperatures.sql
Normal file
9
pkg/repository/postgres/dml/selectTemperatures.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
FROM
|
||||||
|
temperatures
|
8
pkg/repository/postgres/dml/updateDevice.sql
Normal file
8
pkg/repository/postgres/dml/updateDevice.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
UPDATE devices
|
||||||
|
SET
|
||||||
|
device_name = $1,
|
||||||
|
device_location = $2,
|
||||||
|
creation_date = $3,
|
||||||
|
update_date = $4
|
||||||
|
WHERE
|
||||||
|
device_id = $5
|
16
pkg/repository/postgres/dml/updateSensor.sql
Normal file
16
pkg/repository/postgres/dml/updateSensor.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
UPDATE sensors
|
||||||
|
SET
|
||||||
|
sensor_name = $1,
|
||||||
|
sensor_location = $2,
|
||||||
|
wire_id = $3,
|
||||||
|
i2c_bus = $4,
|
||||||
|
i2c_address = $5,
|
||||||
|
gpio_number = $6,
|
||||||
|
sensor_model = $7,
|
||||||
|
sensor_enabled = $8,
|
||||||
|
tick_duration = $9,
|
||||||
|
device_id = $10,
|
||||||
|
creation_date = $11,
|
||||||
|
update_date = $12
|
||||||
|
WHERE
|
||||||
|
sensor_id = $13;
|
100
pkg/repository/postgres/statements.go
Normal file
100
pkg/repository/postgres/statements.go
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
package postgres
|
||||||
|
|
||||||
|
import "embed"
|
||||||
|
|
||||||
|
var (
|
||||||
|
DDLAssetPath = "ddl"
|
||||||
|
|
||||||
|
//go:embed ddl/*.sql
|
||||||
|
DDLAssets embed.FS
|
||||||
|
|
||||||
|
//go:embed dml/deleteDeviceByID.sql
|
||||||
|
DeleteDeviceByIDSQL string
|
||||||
|
|
||||||
|
//go:embed dml/deleteDeviceByName.sql
|
||||||
|
DeleteDeviceByNameSQL string
|
||||||
|
|
||||||
|
//go:embed dml/deleteSensorByID.sql
|
||||||
|
DeleteSensorByIDSQL string
|
||||||
|
|
||||||
|
//go:embed dml/deleteSensorByName.sql
|
||||||
|
DeleteSensorByNameSQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertDevice.sql
|
||||||
|
InsertDeviceSQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertHumidity.sql
|
||||||
|
InsertHumiditySQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertOrUpdateDevice.sql
|
||||||
|
InsertOrUpdateDeviceSQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertOrUpdateHumidity.sql
|
||||||
|
InsertOrUpdateHumiditySQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertOrUpdatePressure.sql
|
||||||
|
InsertOrUpdatePressureSQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertOrUpdateSensor.sql
|
||||||
|
InsertOrUpdateSensorSQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertOrUpdateTemperature.sql
|
||||||
|
InsertOrUpdateTemperatureSQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertPressure.sql
|
||||||
|
InsertPressureSQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertSensor.sql
|
||||||
|
InsertSensorSQL string
|
||||||
|
|
||||||
|
//go:embed dml/insertTemperature.sql
|
||||||
|
InsertTemperatureSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectDeviceByID.sql
|
||||||
|
SelectDeviceByIDSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectDeviceByName.sql
|
||||||
|
SelectDeviceByNameSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectDevices.sql
|
||||||
|
SelectDevicesSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectHumidities.sql
|
||||||
|
SelectHumiditiesSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectHumidityByID.sql
|
||||||
|
SelectHumidityByIDSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectPressureByID.sql
|
||||||
|
SelectPressureByIDSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectPressures.sql
|
||||||
|
SelectPressuresSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectSensorByID.sql
|
||||||
|
SelectSensorByIDSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectSensors.sql
|
||||||
|
SelectSensorsSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectSensorsByDeviceID.sql
|
||||||
|
SelectSensorsByDeviceIDSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectSensorsByModel.sql
|
||||||
|
SelectSensorsByModelSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectSensorsByName.sql
|
||||||
|
SelectSensorsByNameSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectTemperatureByID.sql
|
||||||
|
SelectTemperatureByIDSQL string
|
||||||
|
|
||||||
|
//go:embed dml/selectTemperatures.sql
|
||||||
|
SelectTemperaturesSQL string
|
||||||
|
|
||||||
|
//go:embed dml/updateDevice.sql
|
||||||
|
UpdateDeviceSQL string
|
||||||
|
|
||||||
|
//go:embed dml/updateSensor.sql
|
||||||
|
UpdateSensorSQL string
|
||||||
|
)
|
84
pkg/repository/repository.go
Normal file
84
pkg/repository/repository.go
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/types"
|
||||||
|
"git.cryptic.systems/volker.raschek/go-logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Repository interface {
|
||||||
|
AddDevices(ctx context.Context, devices ...*types.Device) error
|
||||||
|
AddMeasuredValues(ctx context.Context, measuredValues ...*types.MeasuredValue) error
|
||||||
|
AddOrUpdateDevices(ctx context.Context, devices ...*types.Device) error
|
||||||
|
AddOrUpdateMeasuredValues(ctx context.Context, measuredValues ...*types.MeasuredValue) error
|
||||||
|
AddOrUpdateSensors(ctx context.Context, sensors ...*types.Sensor) error
|
||||||
|
AddSensors(ctx context.Context, sensors ...*types.Sensor) error
|
||||||
|
Close() error
|
||||||
|
GetDeviceByID(ctx context.Context, deviceID string) (*types.Device, error)
|
||||||
|
GetDeviceByName(ctx context.Context, name string) (*types.Device, error)
|
||||||
|
GetDevices(ctx context.Context) ([]*types.Device, error)
|
||||||
|
GetHumidities(ctx context.Context) ([]*types.MeasuredValue, error)
|
||||||
|
GetHumidityByID(ctx context.Context, id string) (*types.MeasuredValue, error)
|
||||||
|
GetPressureByID(ctx context.Context, id string) (*types.MeasuredValue, error)
|
||||||
|
GetPressures(ctx context.Context) ([]*types.MeasuredValue, error)
|
||||||
|
GetSensorByID(ctx context.Context, sensorID string) (*types.Sensor, error)
|
||||||
|
GetSensorsByDeviceIDs(ctx context.Context, deviceIDs ...string) ([]*types.Sensor, error)
|
||||||
|
GetSensorsByModels(ctx context.Context, sensorModels ...string) ([]*types.Sensor, error)
|
||||||
|
GetSensorsByNames(ctx context.Context, sensorModels ...string) ([]*types.Sensor, error)
|
||||||
|
GetSensors(ctx context.Context) ([]*types.Sensor, error)
|
||||||
|
GetTemperatureByID(ctx context.Context, id string) (*types.MeasuredValue, error)
|
||||||
|
GetTemperatures(ctx context.Context) ([]*types.MeasuredValue, error)
|
||||||
|
Import(ctx context.Context, src Repository) error
|
||||||
|
Migrate(ctx context.Context) error
|
||||||
|
RemoveDevicesByIDs(ctx context.Context, deviceIDs ...string) error
|
||||||
|
RemoveDevicesByNames(ctx context.Context, names ...string) error
|
||||||
|
RemoveSensorsByIDs(ctx context.Context, sensorIDs ...string) error
|
||||||
|
RemoveSensorsByNames(ctx context.Context, names ...string) error
|
||||||
|
UpdateDevices(ctx context.Context, devices ...*types.Device) error
|
||||||
|
UpdateSensors(ctx context.Context, sensors ...*types.Sensor) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new database backend interface
|
||||||
|
func New(databaseURL *url.URL, flogger logger.Logger) (Repository, error) {
|
||||||
|
switch databaseURL.Scheme {
|
||||||
|
case "postgres":
|
||||||
|
repo, err := NewPostgres(PostgresOpts{
|
||||||
|
DatabaseURL: databaseURL,
|
||||||
|
Logger: flogger,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize database scheme if not exists
|
||||||
|
err = repo.Migrate(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return repo, nil
|
||||||
|
|
||||||
|
case "sqlite3":
|
||||||
|
repo, err := NewSQLite(SQLiteOpts{
|
||||||
|
DatabaseURL: databaseURL,
|
||||||
|
Logger: flogger,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize database scheme if not exists
|
||||||
|
err = repo.Migrate(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return repo, nil
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("Unsupported repository scheme: %v", databaseURL.Scheme)
|
||||||
|
}
|
||||||
|
}
|
541
pkg/repository/repository_test.go
Normal file
541
pkg/repository/repository_test.go
Normal file
@ -0,0 +1,541 @@
|
|||||||
|
package repository_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.cryptic.systems/volker.raschek/dockerutils"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/repository"
|
||||||
|
"git.cryptic.systems/volker.raschek/flucky/pkg/types"
|
||||||
|
"git.cryptic.systems/volker.raschek/go-logger"
|
||||||
|
uuid "github.com/satori/go.uuid"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
_ "github.com/golang-migrate/migrate/v4/database/postgres"
|
||||||
|
_ "github.com/golang-migrate/migrate/v4/database/sqlite3"
|
||||||
|
_ "github.com/lib/pq"
|
||||||
|
_ "github.com/mattn/go-sqlite3"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPostgresBackend(t *testing.T) {
|
||||||
|
require := require.New(t)
|
||||||
|
dockerClient, err := dockerutils.New()
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
rand.Seed(time.Now().Unix())
|
||||||
|
postgresDBPasswort := "postgres"
|
||||||
|
postgresContainerID, err := dockerClient.NewBuilder("postgres:13-alpine").
|
||||||
|
AddEnv("PGTZ", "Europe/Berlin").
|
||||||
|
AddEnv("POSTGRES_PASSWORD", postgresDBPasswort).
|
||||||
|
AddEnv("TZ", "Europe/Berlin").
|
||||||
|
Mount("/etc/localtime", "/etc/localtime").
|
||||||
|
Pull().
|
||||||
|
Start(context.Background())
|
||||||
|
cleanup := func() {
|
||||||
|
dockerClient.ContainerRemoveByIDs(context.Background(), postgresContainerID)
|
||||||
|
}
|
||||||
|
t.Cleanup(cleanup)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
time.Sleep(time.Second * 10)
|
||||||
|
|
||||||
|
// inspect container to get his container ip
|
||||||
|
cjson, err := dockerClient.ContainerInspect(context.Background(), postgresContainerID)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
// postgres://[user]:[password]@[host]:[port]/[path]?[query]
|
||||||
|
dsnURL, err := url.Parse(fmt.Sprintf("postgres://postgres:%v@%v:5432?sslmode=disable", postgresDBPasswort, cjson.NetworkSettings.IPAddress))
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, logger.NewLogger(logger.LogLevelDebug))
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
testBackend(t, repo)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSQLiteBackend(t *testing.T) {
|
||||||
|
require := require.New(t)
|
||||||
|
workspace := filepath.Join(os.TempDir(), uuid.NewV4().String())
|
||||||
|
err := os.MkdirAll(workspace, 0755)
|
||||||
|
require.NoError(err)
|
||||||
|
t.Cleanup(func() { os.RemoveAll(workspace) })
|
||||||
|
|
||||||
|
dsnURL, err := url.Parse(fmt.Sprintf("sqlite3://%v/test.db", workspace))
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
repo, err := repository.New(dsnURL, logger.NewLogger(logger.LogLevelDebug))
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
testBackend(t, repo)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testBackend(t *testing.T, repo repository.Repository) {
|
||||||
|
ctx := context.Background()
|
||||||
|
require := require.New(t)
|
||||||
|
location := uuid.NewV4().String()
|
||||||
|
expectedDevices := []*types.Device{
|
||||||
|
{
|
||||||
|
ID: "39b8f150-8abf-4539-9f16-7f68cedb1649",
|
||||||
|
Name: "62e3978f-2198-4aa9-9d6f-cdc91a468b00",
|
||||||
|
Location: &location,
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: "ec0be3ab-d26d-4f9b-a96e-23ae5c577f8f",
|
||||||
|
Name: "f2b245eb-b15f-40e1-9212-9a645907b710",
|
||||||
|
Location: &location,
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test: AddDevice
|
||||||
|
err := repo.AddDevices(ctx, expectedDevices...)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
// Test: GetDevices
|
||||||
|
devices, err := repo.GetDevices(ctx)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(devices, len(expectedDevices))
|
||||||
|
require.JSONEq(jsonEncoder(expectedDevices), jsonEncoder(devices))
|
||||||
|
|
||||||
|
// Test: GetDeviceByID
|
||||||
|
device, err := repo.GetDeviceByID(ctx, expectedDevices[0].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.JSONEq(jsonEncoder(expectedDevices[0]), jsonEncoder(device))
|
||||||
|
|
||||||
|
// Test: GetDeviceByName
|
||||||
|
device, err = repo.GetDeviceByName(ctx, expectedDevices[0].Name)
|
||||||
|
require.NoError(err)
|
||||||
|
require.JSONEq(jsonEncoder(expectedDevices[0]), jsonEncoder(device))
|
||||||
|
|
||||||
|
// Test: RemoveDevicesByIDs
|
||||||
|
err = repo.RemoveDevicesByIDs(ctx, expectedDevices[0].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
devices, err = repo.GetDevices(ctx)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(devices, 1)
|
||||||
|
|
||||||
|
device, err = repo.GetDeviceByID(ctx, expectedDevices[0].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Nil(device)
|
||||||
|
|
||||||
|
// Test: RemoveDevicesByNames
|
||||||
|
err = repo.RemoveDevicesByNames(ctx, expectedDevices[0].Name)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
devices, err = repo.GetDevices(ctx)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(devices, 1)
|
||||||
|
|
||||||
|
device, err = repo.GetDeviceByID(ctx, expectedDevices[0].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Nil(device)
|
||||||
|
|
||||||
|
err = repo.AddDevices(ctx, expectedDevices[0])
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
// Test: Update Devices
|
||||||
|
location = "MyLocation"
|
||||||
|
expectedDevice := &types.Device{
|
||||||
|
ID: "ec0be3ab-d26d-4f9b-a96e-23ae5c577f8f",
|
||||||
|
Name: "Hello World",
|
||||||
|
Location: &location,
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.UpdateDevices(ctx, expectedDevice)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
device, err = repo.GetDeviceByID(ctx, expectedDevice.ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotEmpty(device)
|
||||||
|
require.Equal(expectedDevice.ID, device.ID)
|
||||||
|
require.Equal(expectedDevice.Name, device.Name)
|
||||||
|
require.Equal(expectedDevice.Location, device.Location)
|
||||||
|
|
||||||
|
// Test: AddOrUpdateDevices
|
||||||
|
location = "MySweetLocation"
|
||||||
|
expectedDevice = &types.Device{
|
||||||
|
ID: "9d8c59a5-7927-4a7c-ad48-dbf5405ffd68",
|
||||||
|
Name: "MySweetDevice",
|
||||||
|
Location: &location,
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
}
|
||||||
|
err = repo.AddOrUpdateDevices(ctx, expectedDevice)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
// time.Sleep(time.Minute * 10)
|
||||||
|
|
||||||
|
device, err = repo.GetDeviceByID(ctx, expectedDevice.ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotEmpty(device)
|
||||||
|
require.Equal(expectedDevice.ID, device.ID)
|
||||||
|
require.Equal(expectedDevice.Name, device.Name)
|
||||||
|
require.Equal(expectedDevice.Location, device.Location)
|
||||||
|
|
||||||
|
location = "MyUglyLocation"
|
||||||
|
expectedDevice = &types.Device{
|
||||||
|
ID: "9d8c59a5-7927-4a7c-ad48-dbf5405ffd68",
|
||||||
|
Name: "MyUglyDevice",
|
||||||
|
Location: &location,
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
}
|
||||||
|
err = repo.AddOrUpdateDevices(ctx, expectedDevice)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
device, err = repo.GetDeviceByID(ctx, expectedDevice.ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotEmpty(device)
|
||||||
|
require.Equal(expectedDevice.ID, device.ID)
|
||||||
|
require.Equal(expectedDevice.Name, device.Name)
|
||||||
|
require.Equal(expectedDevice.Location, device.Location)
|
||||||
|
|
||||||
|
var (
|
||||||
|
wireID = "50473fdc-f6ef-4227-b3c4-484d8e9c1323"
|
||||||
|
i2cBus = 1
|
||||||
|
i2cAddress uint8 = 76
|
||||||
|
expectedSensors = []*types.Sensor{
|
||||||
|
{
|
||||||
|
ID: "0f8b88b0-c20d-42b2-ab51-b09ca99c0752",
|
||||||
|
Name: "01fbdbe9-cebf-42ed-8065-bf4882ccf76b",
|
||||||
|
Location: "6d5b5450-1f87-47cb-b185-f64c35fae3c1",
|
||||||
|
GPIONumber: "GPIO14",
|
||||||
|
Model: "DHT11",
|
||||||
|
Enabled: true,
|
||||||
|
TickDuration: "1m",
|
||||||
|
DeviceID: "ec0be3ab-d26d-4f9b-a96e-23ae5c577f8f",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: "80b1c4bd-abec-4ff0-afb4-bd70aeed0c83",
|
||||||
|
Name: "544365ee-ece9-44ea-911d-5d920a68d4ba",
|
||||||
|
Location: "7ae2d05e-9e6b-4d2d-b26a-cb4acca83778",
|
||||||
|
WireID: &wireID,
|
||||||
|
Model: "DS18B20",
|
||||||
|
Enabled: true,
|
||||||
|
TickDuration: "5m",
|
||||||
|
DeviceID: "ec0be3ab-d26d-4f9b-a96e-23ae5c577f8f",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: "8c74397f-8e60-4c9d-960d-3197747cef9a",
|
||||||
|
Name: "4b808675-de02-4866-893d-1c77f23b9304",
|
||||||
|
Location: "8a085c0f-dd3c-447f-8c4e-c4c1d869c7b6",
|
||||||
|
I2CBus: &i2cBus,
|
||||||
|
I2CAddress: &i2cAddress,
|
||||||
|
Model: "BME280",
|
||||||
|
Enabled: false,
|
||||||
|
TickDuration: "10m",
|
||||||
|
DeviceID: "39b8f150-8abf-4539-9f16-7f68cedb1649",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Test: AddSensors
|
||||||
|
err = repo.AddSensors(ctx, expectedSensors...)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
// Test: GetSensors
|
||||||
|
sensors, err := repo.GetSensors(ctx)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, len(expectedSensors))
|
||||||
|
|
||||||
|
// Test: GetSensorsByNames
|
||||||
|
sensors, err = repo.GetSensorsByNames(ctx, "01fbdbe9-cebf-42ed-8065-bf4882ccf76b")
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, 1)
|
||||||
|
require.JSONEq(jsonEncoder(expectedSensors[0]), jsonEncoder(sensors[0]))
|
||||||
|
|
||||||
|
// Test: GetSensorsByModels
|
||||||
|
sensors, err = repo.GetSensorsByModels(ctx, "BME280")
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, 1)
|
||||||
|
require.JSONEq(jsonEncoder(expectedSensors[2]), jsonEncoder(sensors[0]))
|
||||||
|
|
||||||
|
sensors, err = repo.GetSensorsByModels(ctx, "DS18B20")
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, 1)
|
||||||
|
require.JSONEq(jsonEncoder(expectedSensors[1]), jsonEncoder(sensors[0]))
|
||||||
|
|
||||||
|
sensors, err = repo.GetSensorsByModels(ctx, "DHT11")
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, 1)
|
||||||
|
require.JSONEq(jsonEncoder(expectedSensors[0]), jsonEncoder(sensors[0]))
|
||||||
|
|
||||||
|
sensors, err = repo.GetSensorsByModels(ctx, "DHT11", "DS18B20")
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, 2)
|
||||||
|
require.JSONEq(jsonEncoder(expectedSensors[0:2]), jsonEncoder(sensors[0:2]))
|
||||||
|
|
||||||
|
// Test: GetSensorByID
|
||||||
|
sensor, err := repo.GetSensorByID(ctx, expectedSensors[0].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.JSONEq(jsonEncoder(expectedSensors[0]), jsonEncoder(sensor))
|
||||||
|
|
||||||
|
// Test: GetSensorsByDeviceID
|
||||||
|
sensors, err = repo.GetSensorsByDeviceIDs(ctx, "ec0be3ab-d26d-4f9b-a96e-23ae5c577f8f")
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, 2)
|
||||||
|
require.JSONEq(jsonEncoder(expectedSensors[0:2]), jsonEncoder(sensors))
|
||||||
|
|
||||||
|
// Test: RemoveSensorsByIDs
|
||||||
|
err = repo.RemoveSensorsByIDs(ctx, expectedSensors[0].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
sensors, err = repo.GetSensors(ctx)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, 2)
|
||||||
|
|
||||||
|
sensors, err = repo.GetSensorsByDeviceIDs(ctx, "ec0be3ab-d26d-4f9b-a96e-23ae5c577f8f")
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, 1)
|
||||||
|
|
||||||
|
sensor, err = repo.GetSensorByID(ctx, expectedSensors[0].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Nil(sensor)
|
||||||
|
|
||||||
|
// Test: RemoveSensorsByNames
|
||||||
|
err = repo.RemoveSensorsByNames(ctx, expectedSensors[1].Name)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
sensors, err = repo.GetSensors(ctx)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Len(sensors, 1)
|
||||||
|
|
||||||
|
sensor, err = repo.GetSensorByID(ctx, expectedSensors[1].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.Nil(sensor)
|
||||||
|
|
||||||
|
// Test: UpdateSensors
|
||||||
|
expectedSensor := &types.Sensor{
|
||||||
|
ID: "8c74397f-8e60-4c9d-960d-3197747cef9a",
|
||||||
|
Name: "4b808675-de02-4866-893d-1c77f23b9304",
|
||||||
|
Location: "Ăśber den Wolken muss die Freiheit wohl grenzenlos sein...",
|
||||||
|
I2CBus: nil,
|
||||||
|
I2CAddress: nil,
|
||||||
|
Model: "SDS011",
|
||||||
|
Enabled: true,
|
||||||
|
TickDuration: "6h",
|
||||||
|
DeviceID: "39b8f150-8abf-4539-9f16-7f68cedb1649",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.UpdateSensors(ctx, expectedSensor)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
sensor, err = repo.GetSensorByID(ctx, expectedSensor.ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotNil(sensor)
|
||||||
|
// require.JSONEq(jsonEncoder(expectedSensor), jsonEncoder(sensor))
|
||||||
|
|
||||||
|
// Test: AddOrUpdateSensors
|
||||||
|
expectedSensor = &types.Sensor{
|
||||||
|
ID: "9bba0e0a-e996-4242-966f-db21bab6752f",
|
||||||
|
Name: "b4ac3d0f-cef6-4e93-bd7b-e821ae5ab593",
|
||||||
|
Location: "HelloWorld",
|
||||||
|
I2CBus: nil,
|
||||||
|
I2CAddress: nil,
|
||||||
|
Model: "SDS011",
|
||||||
|
Enabled: true,
|
||||||
|
TickDuration: "6h",
|
||||||
|
DeviceID: "39b8f150-8abf-4539-9f16-7f68cedb1649",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.AddOrUpdateSensors(ctx, expectedSensor)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
sensor, err = repo.GetSensorByID(ctx, expectedSensor.ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotEmpty(sensor)
|
||||||
|
require.Equal(expectedSensor.ID, sensor.ID)
|
||||||
|
require.Equal(expectedSensor.Name, sensor.Name)
|
||||||
|
require.Equal(expectedSensor.Location, sensor.Location)
|
||||||
|
require.Equal(expectedSensor.I2CBus, sensor.I2CBus)
|
||||||
|
require.Equal(expectedSensor.I2CAddress, sensor.I2CAddress)
|
||||||
|
require.Equal(expectedSensor.Model, sensor.Model)
|
||||||
|
require.Equal(expectedSensor.Enabled, sensor.Enabled)
|
||||||
|
require.Equal(expectedSensor.TickDuration, sensor.TickDuration)
|
||||||
|
require.Equal(expectedSensor.DeviceID, sensor.DeviceID)
|
||||||
|
|
||||||
|
expectedSensor = &types.Sensor{
|
||||||
|
ID: "9bba0e0a-e996-4242-966f-db21bab6752f",
|
||||||
|
Name: "MySweetSensor",
|
||||||
|
Location: "MySweetLocation",
|
||||||
|
I2CBus: nil,
|
||||||
|
I2CAddress: nil,
|
||||||
|
Model: "Jap",
|
||||||
|
Enabled: false,
|
||||||
|
TickDuration: "8h",
|
||||||
|
DeviceID: "39b8f150-8abf-4539-9f16-7f68cedb1649",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.AddOrUpdateSensors(ctx, expectedSensor)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
sensor, err = repo.GetSensorByID(ctx, expectedSensor.ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotEmpty(sensor)
|
||||||
|
require.Equal(expectedSensor.ID, sensor.ID)
|
||||||
|
require.Equal(expectedSensor.Name, sensor.Name)
|
||||||
|
require.Equal(expectedSensor.Location, sensor.Location)
|
||||||
|
require.Equal(expectedSensor.I2CBus, sensor.I2CBus)
|
||||||
|
require.Equal(expectedSensor.I2CAddress, sensor.I2CAddress)
|
||||||
|
require.Equal(expectedSensor.Model, sensor.Model)
|
||||||
|
require.Equal(expectedSensor.Enabled, sensor.Enabled)
|
||||||
|
require.Equal(expectedSensor.TickDuration, sensor.TickDuration)
|
||||||
|
require.Equal(expectedSensor.DeviceID, sensor.DeviceID)
|
||||||
|
|
||||||
|
var (
|
||||||
|
expectedMeasuredValues = []*types.MeasuredValue{
|
||||||
|
{
|
||||||
|
ID: "2e5a297a-3da0-46ae-89d2-0fcab0f1d5f7",
|
||||||
|
Value: 32,
|
||||||
|
ValueType: types.Humidity,
|
||||||
|
Date: *timeNow(require),
|
||||||
|
SensorID: "8c74397f-8e60-4c9d-960d-3197747cef9a",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
UpdateDate: nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: "d69f1b62-0c6c-4058-b42c-4a2821bd220c",
|
||||||
|
Value: 38,
|
||||||
|
ValueType: types.Pressure,
|
||||||
|
Date: *timeNow(require),
|
||||||
|
SensorID: "8c74397f-8e60-4c9d-960d-3197747cef9a",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
UpdateDate: nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: "ea945ae0-412b-4561-a191-1f8f1f909fa4",
|
||||||
|
Value: 35.4,
|
||||||
|
ValueType: types.Temperature,
|
||||||
|
Date: *timeNow(require),
|
||||||
|
SensorID: "8c74397f-8e60-4c9d-960d-3197747cef9a",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
UpdateDate: nil,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Test: AddMeasuredValues
|
||||||
|
err = repo.AddMeasuredValues(ctx, expectedMeasuredValues...)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
for i := range expectedMeasuredValues {
|
||||||
|
|
||||||
|
var (
|
||||||
|
err error
|
||||||
|
measuredValue *types.MeasuredValue
|
||||||
|
)
|
||||||
|
|
||||||
|
switch expectedMeasuredValues[i].ValueType {
|
||||||
|
case types.Humidity:
|
||||||
|
measuredValue, err = repo.GetHumidityByID(ctx, expectedMeasuredValues[i].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotNil(measuredValue)
|
||||||
|
case types.Pressure:
|
||||||
|
measuredValue, err = repo.GetPressureByID(ctx, expectedMeasuredValues[i].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotNil(measuredValue)
|
||||||
|
case types.Temperature:
|
||||||
|
measuredValue, err = repo.GetTemperatureByID(ctx, expectedMeasuredValues[i].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotNil(measuredValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
require.Equal(expectedMeasuredValues[i].ID, measuredValue.ID)
|
||||||
|
require.Equal(expectedMeasuredValues[i].Value, measuredValue.Value)
|
||||||
|
require.Equal(expectedMeasuredValues[i].ValueType, measuredValue.ValueType)
|
||||||
|
require.Equal(expectedMeasuredValues[i].SensorID, measuredValue.SensorID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test: AddOrUpdateMeasuredValues
|
||||||
|
expectedMeasuredValues = []*types.MeasuredValue{
|
||||||
|
{
|
||||||
|
ID: "2e5a297a-3da0-46ae-89d2-0fcab0f1d5f7",
|
||||||
|
Value: 35,
|
||||||
|
ValueType: types.Humidity,
|
||||||
|
Date: *timeNow(require),
|
||||||
|
SensorID: "8c74397f-8e60-4c9d-960d-3197747cef9a",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
UpdateDate: timeNow(require),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: "d69f1b62-0c6c-4058-b42c-4a2821bd220c",
|
||||||
|
Value: 37,
|
||||||
|
ValueType: types.Pressure,
|
||||||
|
Date: *timeNow(require),
|
||||||
|
SensorID: "8c74397f-8e60-4c9d-960d-3197747cef9a",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
UpdateDate: timeNow(require),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: "ea945ae0-412b-4561-a191-1f8f1f909fa4",
|
||||||
|
Value: 35.4,
|
||||||
|
ValueType: types.Temperature,
|
||||||
|
Date: *timeNow(require),
|
||||||
|
SensorID: "8c74397f-8e60-4c9d-960d-3197747cef9a",
|
||||||
|
CreationDate: *timeNow(require),
|
||||||
|
UpdateDate: timeNow(require),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.AddOrUpdateMeasuredValues(ctx, expectedMeasuredValues...)
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
for i := range expectedMeasuredValues {
|
||||||
|
|
||||||
|
var (
|
||||||
|
err error
|
||||||
|
measuredValue *types.MeasuredValue
|
||||||
|
)
|
||||||
|
|
||||||
|
switch expectedMeasuredValues[i].ValueType {
|
||||||
|
case types.Humidity:
|
||||||
|
measuredValue, err = repo.GetHumidityByID(ctx, expectedMeasuredValues[i].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotNil(measuredValue)
|
||||||
|
case types.Pressure:
|
||||||
|
measuredValue, err = repo.GetPressureByID(ctx, expectedMeasuredValues[i].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotNil(measuredValue)
|
||||||
|
case types.Temperature:
|
||||||
|
measuredValue, err = repo.GetTemperatureByID(ctx, expectedMeasuredValues[i].ID)
|
||||||
|
require.NoError(err)
|
||||||
|
require.NotNil(measuredValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
require.Equal(expectedMeasuredValues[i].ID, measuredValue.ID)
|
||||||
|
require.Equal(expectedMeasuredValues[i].Value, measuredValue.Value)
|
||||||
|
require.Equal(expectedMeasuredValues[i].ValueType, measuredValue.ValueType)
|
||||||
|
require.Equal(expectedMeasuredValues[i].SensorID, measuredValue.SensorID)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func jsonEncoder(v interface{}) string {
|
||||||
|
body := make([]byte, 0)
|
||||||
|
buffer := bytes.NewBuffer(body)
|
||||||
|
jsonEncoder := json.NewEncoder(buffer)
|
||||||
|
jsonEncoder.SetIndent("", " ")
|
||||||
|
jsonEncoder.Encode(v)
|
||||||
|
return buffer.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func timeNow(require *require.Assertions) *time.Time {
|
||||||
|
now, err := time.Parse("2006-01-02 15:04:05.999999-07", time.Now().Format("2006-01-02 15:04:05.999999-07"))
|
||||||
|
require.NoError(err)
|
||||||
|
return &now
|
||||||
|
}
|
1179
pkg/repository/sqlite.go
Normal file
1179
pkg/repository/sqlite.go
Normal file
File diff suppressed because it is too large
Load Diff
1
pkg/repository/sqlite3/ddl/1_table_devices.down.sql
Normal file
1
pkg/repository/sqlite3/ddl/1_table_devices.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE devices;
|
8
pkg/repository/sqlite3/ddl/1_table_devices.up.sql
Normal file
8
pkg/repository/sqlite3/ddl/1_table_devices.up.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
CREATE TABLE devices (
|
||||||
|
device_id CHAR(36) NOT NULL,
|
||||||
|
device_name VARCHAR(64) NOT NULL,
|
||||||
|
device_location VARCHAR(64),
|
||||||
|
creation_date TIMESTAMP DEFAULT (datetime('now', 'localtime')) NOT NULL,
|
||||||
|
update_date TIMESTAMP,
|
||||||
|
CONSTRAINT pk_devices PRIMARY KEY (device_id)
|
||||||
|
);
|
1
pkg/repository/sqlite3/ddl/2_table_sensors.down.sql
Normal file
1
pkg/repository/sqlite3/ddl/2_table_sensors.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE sensors;
|
17
pkg/repository/sqlite3/ddl/2_table_sensors.up.sql
Normal file
17
pkg/repository/sqlite3/ddl/2_table_sensors.up.sql
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
CREATE TABLE sensors (
|
||||||
|
sensor_id CHAR(36) NOT NULL,
|
||||||
|
sensor_name VARCHAR(64) NOT NULL,
|
||||||
|
sensor_location VARCHAR(64),
|
||||||
|
wire_id VARCHAR(64),
|
||||||
|
i2c_bus VARCHAR(255),
|
||||||
|
i2c_address VARCHAR(12),
|
||||||
|
gpio_number VARCHAR(6),
|
||||||
|
sensor_model VARCHAR(16) NOT NULL,
|
||||||
|
sensor_enabled INTEGER(1) DEFAULT 1 NOT NULL,
|
||||||
|
tick_duration VARCHAR(6) NOT NULL,
|
||||||
|
device_id CHAR(36) NOT NULL,
|
||||||
|
creation_date TIMESTAMP DEFAULT (datetime('now', 'localtime')) NOT NULL,
|
||||||
|
update_date TIMESTAMP,
|
||||||
|
CONSTRAINT pk_sensors PRIMARY KEY(sensor_id),
|
||||||
|
CONSTRAINT fk_sensors_device_id FOREIGN KEY(device_id) REFERENCES devices(device_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
1
pkg/repository/sqlite3/ddl/3_table_humidities.down.sql
Normal file
1
pkg/repository/sqlite3/ddl/3_table_humidities.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE humidities;
|
10
pkg/repository/sqlite3/ddl/3_table_humidities.up.sql
Normal file
10
pkg/repository/sqlite3/ddl/3_table_humidities.up.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
CREATE TABLE humidities (
|
||||||
|
id CHAR(36) NOT NULL,
|
||||||
|
value NUMERIC(10,3) NOT NULL,
|
||||||
|
date TIMESTAMP NOT NULL,
|
||||||
|
sensor_id CHAR(36) NOT NULL,
|
||||||
|
creation_date TIMESTAMP DEFAULT (datetime('now', 'localtime')) NOT NULL,
|
||||||
|
update_date TIMESTAMP,
|
||||||
|
CONSTRAINT pk_humidities PRIMARY KEY(id),
|
||||||
|
CONSTRAINT fk_humidities_sensor_id FOREIGN KEY(sensor_id) REFERENCES sensors(sensor_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
1
pkg/repository/sqlite3/ddl/4_table_pressures.down.sql
Normal file
1
pkg/repository/sqlite3/ddl/4_table_pressures.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE humidities;
|
10
pkg/repository/sqlite3/ddl/4_table_pressures.up.sql
Normal file
10
pkg/repository/sqlite3/ddl/4_table_pressures.up.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
CREATE TABLE pressures (
|
||||||
|
id CHAR(36) NOT NULL,
|
||||||
|
value NUMERIC(10,3) NOT NULL,
|
||||||
|
date TIMESTAMP NOT NULL,
|
||||||
|
sensor_id CHAR(36) NOT NULL,
|
||||||
|
creation_date TIMESTAMP DEFAULT (datetime('now', 'localtime')) NOT NULL,
|
||||||
|
update_date TIMESTAMP,
|
||||||
|
CONSTRAINT pk_pressures PRIMARY KEY(id),
|
||||||
|
CONSTRAINT fk_pressures_sensor_id FOREIGN KEY(sensor_id) REFERENCES sensors(sensor_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
1
pkg/repository/sqlite3/ddl/5_table_temperatures.down.sql
Normal file
1
pkg/repository/sqlite3/ddl/5_table_temperatures.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE temperatures;
|
10
pkg/repository/sqlite3/ddl/5_table_temperatures.up.sql
Normal file
10
pkg/repository/sqlite3/ddl/5_table_temperatures.up.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
CREATE TABLE temperatures (
|
||||||
|
id CHAR(36) NOT NULL,
|
||||||
|
value NUMERIC(10,3) NOT NULL,
|
||||||
|
date TIMESTAMP NOT NULL,
|
||||||
|
sensor_id CHAR(36) NOT NULL,
|
||||||
|
creation_date TIMESTAMP DEFAULT (datetime('now', 'localtime')) NOT NULL,
|
||||||
|
update_date TIMESTAMP,
|
||||||
|
CONSTRAINT pk_temperatures PRIMARY KEY(id),
|
||||||
|
CONSTRAINT fk_temperatures_id FOREIGN KEY(sensor_id) REFERENCES sensors(sensor_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
2
pkg/repository/sqlite3/dml/deleteDeviceByID.sql
Normal file
2
pkg/repository/sqlite3/dml/deleteDeviceByID.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DELETE FROM devices
|
||||||
|
WHERE device_id = $1;
|
2
pkg/repository/sqlite3/dml/deleteDeviceByName.sql
Normal file
2
pkg/repository/sqlite3/dml/deleteDeviceByName.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DELETE FROM devices
|
||||||
|
WHERE device_name = $1;
|
2
pkg/repository/sqlite3/dml/deleteSensorByID.sql
Normal file
2
pkg/repository/sqlite3/dml/deleteSensorByID.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DELETE FROM sensors
|
||||||
|
WHERE sensor_id = $1;
|
2
pkg/repository/sqlite3/dml/deleteSensorByName.sql
Normal file
2
pkg/repository/sqlite3/dml/deleteSensorByName.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DELETE FROM sensors
|
||||||
|
WHERE sensor_name = $1;
|
8
pkg/repository/sqlite3/dml/insertDevice.sql
Normal file
8
pkg/repository/sqlite3/dml/insertDevice.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
INSERT INTO devices (
|
||||||
|
device_id,
|
||||||
|
device_name,
|
||||||
|
device_location,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5);
|
9
pkg/repository/sqlite3/dml/insertHumidity.sql
Normal file
9
pkg/repository/sqlite3/dml/insertHumidity.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
INSERT INTO humidities (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6);
|
14
pkg/repository/sqlite3/dml/insertOrUpdateDevice.sql
Normal file
14
pkg/repository/sqlite3/dml/insertOrUpdateDevice.sql
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
INSERT INTO devices (
|
||||||
|
device_id,
|
||||||
|
device_name,
|
||||||
|
device_location,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5)
|
||||||
|
ON CONFLICT (device_id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
device_name = EXCLUDED.device_name,
|
||||||
|
device_location = EXCLUDED.device_location,
|
||||||
|
update_date = date('now');
|
16
pkg/repository/sqlite3/dml/insertOrUpdateHumidity.sql
Normal file
16
pkg/repository/sqlite3/dml/insertOrUpdateHumidity.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INSERT INTO humidities (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
|
ON CONFLICT (id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
value = EXCLUDED.value,
|
||||||
|
date = EXCLUDED.date,
|
||||||
|
sensor_id = EXCLUDED.sensor_id,
|
||||||
|
update_date = date('now');
|
16
pkg/repository/sqlite3/dml/insertOrUpdatePressure.sql
Normal file
16
pkg/repository/sqlite3/dml/insertOrUpdatePressure.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INSERT INTO pressures (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
|
ON CONFLICT (id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
value = EXCLUDED.value,
|
||||||
|
date = EXCLUDED.date,
|
||||||
|
sensor_id = EXCLUDED.sensor_id,
|
||||||
|
update_date = date('now');
|
31
pkg/repository/sqlite3/dml/insertOrUpdateSensor.sql
Normal file
31
pkg/repository/sqlite3/dml/insertOrUpdateSensor.sql
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
INSERT INTO sensors (
|
||||||
|
sensor_id,
|
||||||
|
sensor_name,
|
||||||
|
sensor_location,
|
||||||
|
wire_id,
|
||||||
|
i2c_bus,
|
||||||
|
i2c_address,
|
||||||
|
gpio_number,
|
||||||
|
sensor_model,
|
||||||
|
sensor_enabled,
|
||||||
|
tick_duration,
|
||||||
|
device_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
|
||||||
|
ON CONFLICT (sensor_id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
sensor_name = EXCLUDED.sensor_name,
|
||||||
|
sensor_location = EXCLUDED.sensor_location,
|
||||||
|
wire_id = EXCLUDED.wire_id,
|
||||||
|
i2c_bus = EXCLUDED.i2c_bus,
|
||||||
|
i2c_address = EXCLUDED.i2c_address,
|
||||||
|
gpio_number = EXCLUDED.gpio_number,
|
||||||
|
sensor_model = EXCLUDED.sensor_model,
|
||||||
|
sensor_enabled = EXCLUDED.sensor_enabled,
|
||||||
|
tick_duration = EXCLUDED.tick_duration,
|
||||||
|
device_id = EXCLUDED.device_id,
|
||||||
|
creation_date = EXCLUDED.creation_date,
|
||||||
|
update_date = date('now');
|
16
pkg/repository/sqlite3/dml/insertOrUpdateTemperature.sql
Normal file
16
pkg/repository/sqlite3/dml/insertOrUpdateTemperature.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INSERT INTO temperatures (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
|
ON CONFLICT (id)
|
||||||
|
DO
|
||||||
|
UPDATE SET
|
||||||
|
value = EXCLUDED.value,
|
||||||
|
date = EXCLUDED.date,
|
||||||
|
sensor_id = EXCLUDED.sensor_id,
|
||||||
|
update_date = date('now');
|
9
pkg/repository/sqlite3/dml/insertPressure.sql
Normal file
9
pkg/repository/sqlite3/dml/insertPressure.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
INSERT INTO pressures (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6);
|
16
pkg/repository/sqlite3/dml/insertSensor.sql
Normal file
16
pkg/repository/sqlite3/dml/insertSensor.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INSERT INTO sensors (
|
||||||
|
sensor_id,
|
||||||
|
sensor_name,
|
||||||
|
sensor_location,
|
||||||
|
wire_id,
|
||||||
|
i2c_bus,
|
||||||
|
i2c_address,
|
||||||
|
gpio_number,
|
||||||
|
sensor_model,
|
||||||
|
sensor_enabled,
|
||||||
|
tick_duration,
|
||||||
|
device_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13);
|
9
pkg/repository/sqlite3/dml/insertTemperature.sql
Normal file
9
pkg/repository/sqlite3/dml/insertTemperature.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
INSERT INTO temperatures (
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
date,
|
||||||
|
sensor_id,
|
||||||
|
creation_date,
|
||||||
|
update_date
|
||||||
|
)
|
||||||
|
VALUES ($1, $2, $3, $4, $5, $6);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user