Skip to content

Commit

Permalink
Moved limit in method calls (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinapathak authored Mar 22, 2019
1 parent 4b56ce0 commit afc23ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/executer.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type dbDecorator struct {
}

func (b *dbDecorator) find(out *[]Record, limit int, where ...interface{}) error {
db := b.Order("birth_date desc").Find(out, where...).Limit(limit)
db := b.Order("birth_date desc").Limit(limit).Find(out, where...)
return db.Error
}

Expand Down
1 change: 1 addition & 0 deletions deploy/docker-compose/docFiles/gungnir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

authHeader: ["YXV0aEhlYWRlcg=="]

getLimit: 2
getRetries: 0
retryInterval: 0s
db:
Expand Down
3 changes: 2 additions & 1 deletion deploy/docker-compose/setup_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ SQL="/cockroach/cockroach.sh sql $HOSTPARAMS"

$SQL -e "CREATE USER IF NOT EXISTS roachadmin;"
$SQL -e "CREATE DATABASE IF NOT EXISTS devices;"
$SQL -e "GRANT ALL ON DATABASE devices TO roachadmin;"
$SQL -e "GRANT ALL ON DATABASE devices TO roachadmin;"
$SQL -e "CREATE TABLE devices.events (id BIGINT PRIMARY KEY DEFAULT unique_rowid(), type INT NOT NULL, device_id STRING NOT NULL, birth_date BIGINT NOT NULL, death_date BIGINT NOT NULL, data BYTES NOT NULL, INDEX idx_events_id_birth_date (device_id, birth_date DESC), INDEX idx_events_death_date (death_date DESC)) "

0 comments on commit afc23ae

Please sign in to comment.