Skip to content
Snippets Groups Projects
Unverified Commit c4523040 authored by Oliver's avatar Oliver Committed by GitHub
Browse files

Merge pull request #143 from stanhu/update-redigo-path

Move  location of redisgo
parents 45a5ad28 813a2434
No related branches found
No related tags found
No related merge requests found
Showing
with 1136 additions and 12 deletions
Loading
@@ -14,13 +14,13 @@
Loading
@@ -14,13 +14,13 @@
version = "v1.17.0" version = "v1.17.0"
   
[[projects]] [[projects]]
name = "github.com/garyburd/redigo" name = "github.com/gomodule/redigo"
packages = [ packages = [
"internal", "internal",
"redis" "redis"
] ]
revision = "d1ed5c67e5794de818ea85e6b522fda02623a484" revision = "9c11da706d9b7902c6da69c592f75637793fe121"
version = "v1.4.0" version = "v2.0.0"
   
[[projects]] [[projects]]
branch = "master" branch = "master"
Loading
Loading
Loading
@@ -8,8 +8,8 @@
Loading
@@ -8,8 +8,8 @@
version = "1.17.0" version = "1.17.0"
   
[[constraint]] [[constraint]]
name = "github.com/garyburd/redigo" name = "github.com/gomodule/redigo"
version = "1.4.0" version = "2.0.0"
   
[[constraint]] [[constraint]]
name = "github.com/prometheus/client_golang" name = "github.com/prometheus/client_golang"
Loading
Loading
Loading
@@ -9,7 +9,7 @@ import (
Loading
@@ -9,7 +9,7 @@ import (
"sync" "sync"
"time" "time"
   
"github.com/garyburd/redigo/redis" "github.com/gomodule/redigo/redis"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
prom_strutil "github.com/prometheus/prometheus/util/strutil" prom_strutil "github.com/prometheus/prometheus/util/strutil"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
Loading
Loading
Loading
@@ -20,7 +20,7 @@ import (
Loading
@@ -20,7 +20,7 @@ import (
   
"bytes" "bytes"
"flag" "flag"
"github.com/garyburd/redigo/redis" "github.com/gomodule/redigo/redis"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go" dto "github.com/prometheus/client_model/go"
) )
Loading
Loading
Loading
@@ -2,8 +2,8 @@ package: github.com/oliver006/redis_exporter
Loading
@@ -2,8 +2,8 @@ package: github.com/oliver006/redis_exporter
import: import:
- package: github.com/sirupsen/logrus - package: github.com/sirupsen/logrus
version: v0.11.0 version: v0.11.0
- package: github.com/garyburd/redigo - package: github.com/gomodule/redigo
version: v1.2.0 version: v2.0.0
subpackages: subpackages:
- redis - redis
- package: github.com/prometheus/client_golang - package: github.com/prometheus/client_golang
Loading
Loading
Ask questions at
[StackOverflow](https://stackoverflow.com/questions/ask?tags=go+redis).
[Open an issue](https://github.com/garyburd/redigo/issues/new) to discuss your
plans before doing any work on Redigo.
Ask questions at https://stackoverflow.com/questions/ask?tags=go+redis
language: go
sudo: false
services:
- redis-server
go:
- 1.4
- 1.5.x
- 1.6.x
- 1.7.x
- 1.8.x
- 1.9.x
- 1.10.x
- tip
script:
- go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d .)
- go vet $(go list ./... | grep -v /vendor/)
- go test -v -race ./...
Redigo
======
[![Build Status](https://travis-ci.org/gomodule/redigo.svg?branch=master)](https://travis-ci.org/gomodule/redigo)
[![GoDoc](https://godoc.org/github.com/gomodule/redigo/redis?status.svg)](https://godoc.org/github.com/gomodule/redigo/redis)
Redigo is a [Go](http://golang.org/) client for the [Redis](http://redis.io/) database.
Features
-------
* A [Print-like](http://godoc.org/github.com/gomodule/redigo/redis#hdr-Executing_Commands) API with support for all Redis commands.
* [Pipelining](http://godoc.org/github.com/gomodule/redigo/redis#hdr-Pipelining), including pipelined transactions.
* [Publish/Subscribe](http://godoc.org/github.com/gomodule/redigo/redis#hdr-Publish_and_Subscribe).
* [Connection pooling](http://godoc.org/github.com/gomodule/redigo/redis#Pool).
* [Script helper type](http://godoc.org/github.com/gomodule/redigo/redis#Script) with optimistic use of EVALSHA.
* [Helper functions](http://godoc.org/github.com/gomodule/redigo/redis#hdr-Reply_Helpers) for working with command replies.
Documentation
-------------
- [API Reference](http://godoc.org/github.com/gomodule/redigo/redis)
- [FAQ](https://github.com/gomodule/redigo/wiki/FAQ)
- [Examples](https://godoc.org/github.com/gomodule/redigo/redis#pkg-examples)
Installation
------------
Install Redigo using the "go get" command:
go get github.com/gomodule/redigo/redis
The Go distribution is Redigo's only dependency.
Related Projects
----------------
- [rafaeljusto/redigomock](https://godoc.org/github.com/rafaeljusto/redigomock) - A mock library for Redigo.
- [chasex/redis-go-cluster](https://github.com/chasex/redis-go-cluster) - A Redis cluster client implementation.
- [FZambia/go-sentinel](https://github.com/FZambia/go-sentinel) - Redis Sentinel support for Redigo
- [PuerkitoBio/redisc](https://github.com/PuerkitoBio/redisc) - Redis Cluster client built on top of Redigo
Contributing
------------
See [CONTRIBUTING.md](https://github.com/gomodule/redigo/blob/master/.github/CONTRIBUTING.md).
License
-------
Redigo is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
Loading
@@ -12,7 +12,7 @@
Loading
@@ -12,7 +12,7 @@
// License for the specific language governing permissions and limitations // License for the specific language governing permissions and limitations
// under the License. // under the License.
   
package internal // import "github.com/garyburd/redigo/internal" package internal // import "github.com/gomodule/redigo/internal"
   
import ( import (
"strings" "strings"
Loading
Loading
package internal
import "testing"
func TestLookupCommandInfo(t *testing.T) {
for _, n := range []string{"watch", "WATCH", "wAtch"} {
if LookupCommandInfo(n) == (CommandInfo{}) {
t.Errorf("LookupCommandInfo(%q) = CommandInfo{}, expected non-zero value", n)
}
}
}
func benchmarkLookupCommandInfo(b *testing.B, names ...string) {
for i := 0; i < b.N; i++ {
for _, c := range names {
LookupCommandInfo(c)
}
}
}
func BenchmarkLookupCommandInfoCorrectCase(b *testing.B) {
benchmarkLookupCommandInfo(b, "watch", "WATCH", "monitor", "MONITOR")
}
func BenchmarkLookupCommandInfoMixedCase(b *testing.B) {
benchmarkLookupCommandInfo(b, "wAtch", "WeTCH", "monItor", "MONiTOR")
}
// Copyright 2014 Gary Burd
//
// 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.
// Package redistest contains utilities for writing Redigo tests.
package redistest
import (
"errors"
"time"
"github.com/gomodule/redigo/redis"
)
type testConn struct {
redis.Conn
}
func (t testConn) Close() error {
_, err := t.Conn.Do("SELECT", "9")
if err != nil {
return nil
}
_, err = t.Conn.Do("FLUSHDB")
if err != nil {
return err
}
return t.Conn.Close()
}
// Dial dials the local Redis server and selects database 9. To prevent
// stomping on real data, DialTestDB fails if database 9 contains data. The
// returned connection flushes database 9 on close.
func Dial() (redis.Conn, error) {
c, err := redis.DialTimeout("tcp", ":6379", 0, 1*time.Second, 1*time.Second)
if err != nil {
return nil, err
}
_, err = c.Do("SELECT", "9")
if err != nil {
c.Close()
return nil, err
}
n, err := redis.Int(c.Do("DBSIZE"))
if err != nil {
c.Close()
return nil, err
}
if n != 0 {
c.Close()
return nil, errors.New("database #9 is not empty, test can not continue")
}
return testConn{c}, nil
}
This diff is collapsed.
Loading
@@ -14,7 +14,7 @@
Loading
@@ -14,7 +14,7 @@
   
// Package redis is a client for the Redis database. // Package redis is a client for the Redis database.
// //
// The Redigo FAQ (https://github.com/garyburd/redigo/wiki/FAQ) contains more // The Redigo FAQ (https://github.com/gomodule/redigo/wiki/FAQ) contains more
// documentation about this package. // documentation about this package.
// //
// Connections // Connections
Loading
@@ -174,4 +174,4 @@
Loading
@@ -174,4 +174,4 @@
// non-recoverable error such as a network error or protocol parsing error. If // non-recoverable error such as a network error or protocol parsing error. If
// Err() returns a non-nil value, then the connection is not usable and should // Err() returns a non-nil value, then the connection is not usable and should
// be closed. // be closed.
package redis // import "github.com/garyburd/redigo/redis" package redis // import "github.com/gomodule/redigo/redis"
// Copyright 2018 Gary Burd
//
// 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.
// +build go1.9
package redis
import "testing"
func TestPoolList(t *testing.T) {
var idle idleList
var a, b, c poolConn
check := func(pcs ...*poolConn) {
if idle.count != len(pcs) {
t.Fatal("idle.count != len(pcs)")
}
if len(pcs) == 0 {
if idle.front != nil {
t.Fatalf("front not nil")
}
if idle.back != nil {
t.Fatalf("back not nil")
}
return
}
if idle.front != pcs[0] {
t.Fatal("front != pcs[0]")
}
if idle.back != pcs[len(pcs)-1] {
t.Fatal("back != pcs[len(pcs)-1]")
}
if idle.front.prev != nil {
t.Fatal("front.prev != nil")
}
if idle.back.next != nil {
t.Fatal("back.next != nil")
}
for i := 1; i < len(pcs)-1; i++ {
if pcs[i-1].next != pcs[i] {
t.Fatal("pcs[i-1].next != pcs[i]")
}
if pcs[i+1].prev != pcs[i] {
t.Fatal("pcs[i+1].prev != pcs[i]")
}
}
}
idle.pushFront(&c)
check(&c)
idle.pushFront(&b)
check(&b, &c)
idle.pushFront(&a)
check(&a, &b, &c)
idle.popFront()
check(&b, &c)
idle.popFront()
check(&c)
idle.popFront()
check()
idle.pushFront(&c)
check(&c)
idle.pushFront(&b)
check(&b, &c)
idle.pushFront(&a)
check(&a, &b, &c)
idle.popBack()
check(&a, &b)
idle.popBack()
check(&a)
idle.popBack()
check()
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment