Skip to content

Commit

Permalink
db/redis: update version of go-redis
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Souza committed Nov 6, 2017
1 parent 7573469 commit 6511c74
Show file tree
Hide file tree
Showing 81 changed files with 2,731 additions and 1,423 deletions.
14 changes: 7 additions & 7 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
branch = "master"
name = "github.com/sirupsen/logrus"

[[constraint]]
name = "gopkg.in/redis.v5"
version = "5.2.9"

[[override]]
branch = "master"
name = "github.com/julienschmidt/httprouter"

[[constraint]]
name = "github.com/go-redis/redis"
version = "6.7.3"
2 changes: 1 addition & 1 deletion db/redis/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/NYTimes/video-transcoding-api/db"
"github.com/NYTimes/video-transcoding-api/db/redis/storage"
"gopkg.in/redis.v5"
"github.com/go-redis/redis"
)

const jobsSetKey = "jobs"
Expand Down
2 changes: 1 addition & 1 deletion db/redis/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/NYTimes/video-transcoding-api/db"
"github.com/NYTimes/video-transcoding-api/db/redis/storage"
"github.com/kr/pretty"
"gopkg.in/redis.v5"
"github.com/go-redis/redis"
)

func TestCreateJob(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion db/redis/localpreset.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/NYTimes/video-transcoding-api/db"
"github.com/NYTimes/video-transcoding-api/db/redis/storage"
"gopkg.in/redis.v5"
"github.com/go-redis/redis"
)

const localPresetsSetKey = "localpresets"
Expand Down
2 changes: 1 addition & 1 deletion db/redis/presetmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package redis
import (
"github.com/NYTimes/video-transcoding-api/db"
"github.com/NYTimes/video-transcoding-api/db/redis/storage"
"gopkg.in/redis.v5"
"github.com/go-redis/redis"
)

const presetmapsSetKey = "presetmaps"
Expand Down
2 changes: 1 addition & 1 deletion db/redis/redis_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package redis

import "gopkg.in/redis.v5"
import "github.com/go-redis/redis"

func cleanRedis() error {
client := redis.NewClient(&redis.Options{Addr: "127.0.0.1:6379"})
Expand Down
12 changes: 6 additions & 6 deletions db/redis/storage/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"sync"
"time"

"gopkg.in/redis.v5"
"github.com/go-redis/redis"
)

// ErrNotFound is the error returned when the given key is not found.
Expand Down Expand Up @@ -88,7 +88,7 @@ func (s *Storage) Save(key string, hash interface{}) error {

// FieldMap extract the map of fields from the given type (which can be a
// struct, a map[string]string or pointer to those).
func (s *Storage) FieldMap(hash interface{}) (map[string]string, error) {
func (s *Storage) FieldMap(hash interface{}) (map[string]interface{}, error) {
if hash == nil {
return nil, errors.New("no fields provided")
}
Expand All @@ -106,24 +106,24 @@ func (s *Storage) FieldMap(hash interface{}) (map[string]string, error) {
}
}

func (s *Storage) mapToFieldList(hash interface{}, prefixes ...string) (map[string]string, error) {
func (s *Storage) mapToFieldList(hash interface{}, prefixes ...string) (map[string]interface{}, error) {
m, ok := hash.(map[string]string)
if !ok {
return nil, errors.New("please provide a map[string]string")
}
if len(m) < 1 {
return nil, errors.New("please provide a map[string]string with at least one item")
}
fields := make(map[string]string, len(m))
fields := make(map[string]interface{}, len(m))
for key, value := range m {
key = strings.Join(append(prefixes, key), "_")
fields[key] = value
}
return fields, nil
}

func (s *Storage) structToFieldList(value reflect.Value, prefixes ...string) (map[string]string, error) {
fields := make(map[string]string)
func (s *Storage) structToFieldList(value reflect.Value, prefixes ...string) (map[string]interface{}, error) {
fields := make(map[string]interface{})
for i := 0; i < value.NumField(); i++ {
field := value.Type().Field(i)
if field.PkgPath != "" {
Expand Down
6 changes: 3 additions & 3 deletions db/redis/storage/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func TestFieldMap(t *testing.T) {
var tests = []struct {
description string
hash interface{}
expected map[string]string
expected map[string]interface{}
}{
{
"Job",
Expand All @@ -260,7 +260,7 @@ func TestFieldMap(t *testing.T) {
{Preset: PresetMap{Name: "preset-2"}, FileName: "output2.m3u8"},
},
},
map[string]string{
map[string]interface{}{
"source": "http://nyt.net/source_here.mp4",
"jobID": "job1",
"providerName": "encoding.com",
Expand Down Expand Up @@ -297,7 +297,7 @@ func TestFieldMap(t *testing.T) {
},
},
},
map[string]string{
map[string]interface{}{
"preset_name": "test",
"preset_description": "test preset",
"preset_container": "mp4",
Expand Down
2 changes: 1 addition & 1 deletion provider/zencoder/zencoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/NYTimes/video-transcoding-api/provider"
"github.com/flavioribeiro/zencoder"
"github.com/kr/pretty"
redisDriver "gopkg.in/redis.v5"
redisDriver "github.com/go-redis/redis"
)

func TestFactoryIsRegistered(t *testing.T) {
Expand Down
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6511c74

Please sign in to comment.