util

package
v0.0.0-...-0144ae3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteEmpty

func DeleteEmpty(s []string) []string

func ShortDate

func ShortDate(date *time.Time) string

Types

type Command

type Command interface {
	Val() string
	Result() (string, error)
	String() string
}

type IntCmd

type IntCmd interface {
	Val() int64
	String() string
	Result() (int64, error)
}

type IntCmdMock

type IntCmdMock struct {
	// contains filtered or unexported fields
}

func (*IntCmdMock) Result

func (c *IntCmdMock) Result() (int64, error)

func (*IntCmdMock) String

func (c *IntCmdMock) String() string

func (*IntCmdMock) Val

func (c *IntCmdMock) Val() int64

type RedisClient

type RedisClient interface {
	Get(key string) StringCmd
	Set(key string, value interface{}, expiration time.Duration) StatusCmd
	Erase(key string)
	Exists(key string) bool
	SetAdd(key string, val string) IntCmd
	SetCard(key string) IntCmd
	SetList(key string) ([]string, error)
	SetRemove(key string, val ...string) IntCmd
	SortedSetAdd(key string, score int, value string) bool
	SortedSetRange(key string, min int64, max int64) ([]string, error)
	SortedSetRemoveRange(key string, min int64, max int64) IntCmd
	SortedSetRank(key string, value string) IntCmd
	SortedSetRemove(key string, values ...string) IntCmd
	SortedSetCard(key string) IntCmd
	Keys(pattern string) ([]string, error)
}

func NewRedisMock

func NewRedisMock() RedisClient

type RedisClientMock

type RedisClientMock struct {
	// contains filtered or unexported fields
}

func (*RedisClientMock) Erase

func (r *RedisClientMock) Erase(key string)

func (*RedisClientMock) Exists

func (c *RedisClientMock) Exists(key string) bool

func (*RedisClientMock) Get

func (c *RedisClientMock) Get(key string) StringCmd

func (*RedisClientMock) Keys

func (r *RedisClientMock) Keys(pattern string) ([]string, error)

func (*RedisClientMock) Set

func (c *RedisClientMock) Set(key string, value interface{}, expiration time.Duration) StatusCmd

func (*RedisClientMock) SetAdd

func (r *RedisClientMock) SetAdd(key string, val string) IntCmd

func (*RedisClientMock) SetCard

func (r *RedisClientMock) SetCard(key string) IntCmd

func (*RedisClientMock) SetList

func (r *RedisClientMock) SetList(key string) ([]string, error)

func (*RedisClientMock) SetRemove

func (r *RedisClientMock) SetRemove(key string, val ...string) IntCmd

func (*RedisClientMock) SortedSetAdd

func (r *RedisClientMock) SortedSetAdd(key string, score int, value string) bool

func (*RedisClientMock) SortedSetCard

func (r *RedisClientMock) SortedSetCard(key string) IntCmd

func (*RedisClientMock) SortedSetRange

func (r *RedisClientMock) SortedSetRange(key string, min int64, max int64) ([]string, error)

func (*RedisClientMock) SortedSetRank

func (r *RedisClientMock) SortedSetRank(key string, value string) IntCmd

func (*RedisClientMock) SortedSetRemove

func (r *RedisClientMock) SortedSetRemove(key string, values ...string) IntCmd

func (*RedisClientMock) SortedSetRemoveRange

func (r *RedisClientMock) SortedSetRemoveRange(key string, min int64, max int64) IntCmd

type RedisClientWrap

type RedisClientWrap struct {
	R *redis.Client
}

func (*RedisClientWrap) Erase

func (r *RedisClientWrap) Erase(key string)

func (*RedisClientWrap) Exists

func (r *RedisClientWrap) Exists(key string) bool

func (*RedisClientWrap) Get

func (r *RedisClientWrap) Get(key string) StringCmd

func (*RedisClientWrap) Keys

func (r *RedisClientWrap) Keys(pattern string) ([]string, error)

func (*RedisClientWrap) Set

func (r *RedisClientWrap) Set(key string, value interface{}, expiration time.Duration) StatusCmd

func (*RedisClientWrap) SetAdd

func (r *RedisClientWrap) SetAdd(key string, val string) IntCmd

func (*RedisClientWrap) SetCard

func (r *RedisClientWrap) SetCard(key string) IntCmd

func (*RedisClientWrap) SetList

func (r *RedisClientWrap) SetList(key string) ([]string, error)

func (*RedisClientWrap) SetRemove

func (r *RedisClientWrap) SetRemove(key string, val ...string) IntCmd

func (*RedisClientWrap) SortedSetAdd

func (r *RedisClientWrap) SortedSetAdd(key string, score int, value string) bool

func (*RedisClientWrap) SortedSetCard

func (r *RedisClientWrap) SortedSetCard(key string) IntCmd

func (*RedisClientWrap) SortedSetRange

func (r *RedisClientWrap) SortedSetRange(key string, min int64, max int64) ([]string, error)

func (*RedisClientWrap) SortedSetRank

func (r *RedisClientWrap) SortedSetRank(key string, value string) IntCmd

func (*RedisClientWrap) SortedSetRemove

func (r *RedisClientWrap) SortedSetRemove(key string, values ...string) IntCmd

func (*RedisClientWrap) SortedSetRemoveRange

func (r *RedisClientWrap) SortedSetRemoveRange(key string, min int64, max int64) IntCmd

type StatusCmd

type StatusCmd interface {
	Command
}

type StringCmd

type StringCmd interface {
	Command
	Bytes() ([]byte, error)
	Float64() (float64, error)
	Int64() (int64, error)
	Scan(val interface{}) error
	Uint64() (uint64, error)
}

type StringCmdMock

type StringCmdMock struct {
	*redis.StringCmd
	// contains filtered or unexported fields
}

func (*StringCmdMock) Bytes

func (cmd *StringCmdMock) Bytes() ([]byte, error)

func (*StringCmdMock) Float64

func (cmd *StringCmdMock) Float64() (float64, error)

func (*StringCmdMock) Int64

func (cmd *StringCmdMock) Int64() (int64, error)

func (*StringCmdMock) Result

func (cmd *StringCmdMock) Result() (string, error)

func (*StringCmdMock) Scan

func (cmd *StringCmdMock) Scan(val interface{}) error

func (*StringCmdMock) String

func (cmd *StringCmdMock) String() string

func (*StringCmdMock) Uint64

func (cmd *StringCmdMock) Uint64() (uint64, error)

func (*StringCmdMock) Val

func (cmd *StringCmdMock) Val() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL