func (rl *List) AddEnd(value string) error {
	conn := rl.pool.Get(rl.dbindex)
	_, err := conn.Do("LPUSH", rl.id, value)
	return err
}
Add an element to the end of the list list
package simpleredis
import (
	"errors"
	"strconv"
	"strings"
	"time"
	"github.com/gomodule/redigo/redis"
)
const (
	Version = 2.6
	defaultRedisServer = ":6379"
)
type redisDatastructure struct {
	pool    *ConnectionPool
	id      string
	dbindex int
}
type (
	ConnectionPool redis.Pool
	List     redisDatastructure
	Set      redisDatastructure
	HashMap  redisDatastructure
	KeyValue redisDatastructure
)
var (
	connectTimeout = 7 * time.Second
	readTimeout    = 7 * time.Second
	writeTimeout   = 7 * time.Second
	idleTimeout    = 240 * time.Second
	maxIdleConnections = 3
)
func newRedisConnection() (redis.Conn, error) {
	return newRedisConnectionTo(defaultRedisServer)
}
func newRedisConnectionTo(hostColonPort string) (redis.Conn, error) {
	if _, theRest, ok := twoFields(hostColonPort, "@"); ok {
		hostColonPort = theRest
	}
	hostColonPort = strings.TrimSpace(hostColonPort)
	c, err := redis.Dial("tcp", hostColonPort, redis.DialConnectTimeout(connectTimeout), redis.DialReadTimeout(readTimeout), redis.DialWriteTimeout(writeTimeout))
	if err != nil {
		if c != nil {
			c.Close()
		}
		return nil, err
	}
	return c, nil
}
func getString(bi []interface{}, i int) string {
	return string(bi[i].([]uint8))
}
func TestConnection() (err error) {
	return TestConnectionHost(defaultRedisServer)
}
func TestConnectionHost(hostColonPort string) (err error) {
	conn, err := newRedisConnectionTo(hostColonPort)
	defer func() {
		if conn != nil {
			conn.Close()
		}
		if r := recover(); r != nil {
			err = errors.New("Could not connect to redis server: " + hostColonPort)
		}
	}()
	return err
}
func NewConnectionPool() *ConnectionPool {
	redisPool := &redis.Pool{
		MaxIdle:     maxIdleConnections,
		IdleTimeout: idleTimeout,
		Dial:        newRedisConnection,
	}
	pool := ConnectionPool(*redisPool)
	return &pool
}
func twoFields(s, delim string) (string, string, bool) {
	if strings.Count(s, delim) != 1 {
		return s, "", false
	}
	fields := strings.Split(s, delim)
	return fields[0], fields[1], true
}
func NewConnectionPoolHost(hostColonPort string) *ConnectionPool {
	redisPool := &redis.Pool{
		MaxIdle:     maxIdleConnections,
		IdleTimeout: idleTimeout,
		Dial: func() (redis.Conn, error) {
			conn, err := newRedisConnectionTo(hostColonPort)
			if err != nil {
				return nil, err
			}
			if password, _, ok := twoFields(hostColonPort, "@"); ok {
				if password != "" {
					if _, err := conn.Do("AUTH", password); err != nil {
						conn.Close()
						return nil, err
					}
				}
			}
			return conn, err
		},
	}
	pool := ConnectionPool(*redisPool)
	return &pool
}
func SetMaxIdleConnections(maximum int) {
	maxIdleConnections = maximum
}
func (pool *ConnectionPool) Get(dbindex int) redis.Conn {
	redisPool := redis.Pool(*pool)
	conn := redisPool.Get()
	if dbindex != 0 {
		conn.Do("SELECT", strconv.Itoa(dbindex))
	}
	return conn
}
func (pool *ConnectionPool) Ping() error {
	redisPool := redis.Pool(*pool)
	conn := redisPool.Get()
	_, err := conn.Do("PING")
	return err
}
func (pool *ConnectionPool) Close() {
	redisPool := redis.Pool(*pool)
	redisPool.Close()
}
func NewList(pool *ConnectionPool, id string) *List {
	return &List{pool, id, 0}
}
func (rl *List) SelectDatabase(dbindex int) {
	rl.dbindex = dbindex
}
func (rl *List) Get(index int64) (string, error) {
	conn := rl.pool.Get(rl.dbindex)
	result, err := conn.Do("LINDEX", rl.id)
	if err != nil {
		panic(err)
	}
	return redis.String(result, err)
}
func (rl *List) Size() (int64, error) {
	conn := rl.pool.Get(rl.dbindex)
	size, err := conn.Do("LLEN", rl.id)
	if err != nil {
		panic(err)
	}
	return redis.Int64(size, err)
}
func (rl *List) PopFirst() (string, error) {
	conn := rl.pool.Get(rl.dbindex)
	result, err := conn.Do("LPOP", rl.id)
	if err != nil {
		panic(err)
	}
	return redis.String(result, err)
}
func (rl *List) PopLast() (string, error) {
	conn := rl.pool.Get(rl.dbindex)
	result, err := conn.Do("LPOP", rl.id)
	if err != nil {
		panic(err)
	}
	return redis.String(result, err)
}
func (rl *List) AddStart(value string) error {
	conn := rl.pool.Get(rl.dbindex)
	_, err := conn.Do("RPUSH", rl.id, value)
	return err
}