github.com/therealbill/libredis@v0.0.0-20161227004305-7d50abda5ccf/README.md (about)

     1  # libredis
     2  
     3  [![Code Climate](https://codeclimate.com/github/therealbill/libredis/badges/gpa.svg)](https://codeclimate.com/github/therealbill/libredis)
     4  [![GoDoc](https://godoc.org/github.com/therealbill/libredis?status.png)](https://godoc.org/github.com/therealbill/libredis)
     5  [![Build Status](https://travis-ci.org/therealbill/libredis.svg?branch=master)](https://travis-ci.org/therealbill/libredis)
     6  
     7  Libredis is a library for interacting with Redis. This includes (a '^'
     8  indicates features planned and/or in dev):
     9  
    10  - client connection 
    11  - Sentinel interaction and management
    12  	- Support for SENTINEL commands
    13  	- Ability for client code to manage Sentinel
    14  	- Dedicated control methods^
    15  - Redis INFO parsing
    16  - Inbuilt Sentinel discovery support^
    17  - Inbuilt Redis Cluster support^
    18  - Tested under Go 1.3, 1.4.1, and tip and Redis >=  2.8.13
    19  
    20  
    21  Libredis is intended to be more than a simple client connection library.
    22  It will include Redis specific custom operations, Structures, and
    23  capabilities suitable for integrating with any Go code which interacts
    24  with Redis ranging from simple CRUD operations to service management.
    25  
    26  ## Features
    27  
    28  ### Redis Client
    29  
    30  The client code is a fork from
    31  [Goredis](https://github.com/xuyu/goredis). The code is being cleaned up
    32  and rewritten for better performance and developer usability.
    33  
    34  #### API Volatility
    35  
    36  The original API, while better than other libraries, did not meet what
    37  I felt the API should look like. The info command returned simple
    38  strings, any command which supported variadic arguments required them,
    39  and certain errors should be handled at a lower level and returned in a
    40  more formal manner at the API level. 
    41  
    42  As such, the API is currently under a bit of flux. Any command which
    43  accepts variadic paramters such as `ZAdd` will be changing to be of the
    44  simple form with Variadic added for the variadic call. For example, `ZAdd`
    45  will take the key, score, and value while `ZAddVariadic` will take a
    46  `map[string]float64` to variadic commands. This pattern will spread
    47  through the code as I find them or find the time to pre-emptively fix
    48  them.
    49  
    50  Where appropriate certain known errors will be converted from raw Redis
    51  errors to typed CommandErrors to provide simpler error handling. It is likely
    52  all commands will return a typed CommandError to provide commonality
    53  across the client API.
    54  
    55  #### Notables
    56  
    57  * Python Redis Client Like API
    58  * Support [Pipeling](http://godoc.org/github.com/TheRealBill/libredis#Pipelined)
    59  * Support [Transaction](http://godoc.org/github.com/TheRealBill/libredis#Transaction)
    60  * Support [Publish Subscribe](http://godoc.org/github.com/TheRealBill/libredis#PubSub)
    61  * Support [Lua Eval](http://godoc.org/github.com/TheRealBill/libredis#Redis.Eval)
    62  * Support [Connection Pool](http://godoc.org/github.com/TheRealBill/libredis#ConnPool)
    63  * Support [Dial URL-Like](http://godoc.org/github.com/TheRealBill/libredis#DialURL)
    64  * Support for Sentinel commands
    65  * Support Parsing Redis Info commands into Maps and structs
    66  * Support [monitor](http://godoc.org/github.com/TheRealBill/libredis#MonitorCommand), [sort](http://godoc.org/github.com/TheRealBill/libredis#SortCommand), [scan](http://godoc.org/github.com/TheRealBill/libredis#Redis.Scan), [slowlog](http://godoc.org/github.com/TheRealBill/libredis#SlowLog) .etc
    67  * SSL Support! If you have a provider or proxy providing an SSL endpoint you can now connect to it via libredis.
    68  
    69  
    70  ## Redis Info
    71  
    72  The info package provides functions for parsing the string results of an
    73  Redis info command. When using the libredis/client package these are
    74  unnecessary. This package is useful for those using other Redis client
    75  packages which return strings.
    76  
    77  ### Sentinel Info
    78  
    79  The arguments for `INFO` in Redis when being issued against a Sentinel
    80  returned null for `INFO all`. This has been subsequently fixed to match
    81  the Redis `INFO all` pattern. If using a Redis version of 2.8.13 or
    82  older, use `SentinelInfo` instead of Info to handle this scenario.
    83  
    84  
    85  ## Related Articles
    86  
    87  - [Redis Commands](http://redis.io/commands)
    88  - [Redis Protocol](http://redis.io/topics/protocol)
    89  - [Sentinel](http://redis.io/topics/sentinel)
    90  - [GoDoc](http://godoc.org/github.com/TheRealBill/libredis)
    91  
    92  
    93  
    94  # Running Tests
    95  
    96  
    97  normal test:
    98  
    99  	go test
   100  
   101  coverage test:
   102  
   103  	go test -cover
   104  
   105  coverage test with html result:
   106  
   107  	go test -coverprofile=cover.out
   108  	go tool cover -html=cover.out
   109  
   110  
   111  # Running Benchmarks
   112  
   113  	go test -test.run=none -test.bench="Benchmark.*"
   114