database

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RedisCache cache.Cache

Functions

func BLPop

func BLPop(key string, timeout int64) []string

BLPop LPop的阻塞式弹出(从左侧)

func BRPop

func BRPop(key string, timeout int64) []string

BRPop RPop的阻塞式弹出(从右侧)

func BRPopLPush

func BRPopLPush(source, destination string, timeout int64) string

BRPopLPush RPopLPush的阻塞版本,当列表source为空时将阻塞连接,直到等待超时或有另一个客户端对source执行LPUSH或RPUSH命令为止 @param source string @param destination string @param timeout int64

func Decr

func Decr(key string) (int64, error)

Decr 将key中储存的数字值减一 @param key string @return int64 @return bool

func DecrBy

func DecrBy(key string, increment int64) (int64, error)

DecrBy 将key中储存的数字值减少increment @param key string @param increment int64 @return int64 @return bool

func Del

func Del(key string) bool

Del 删除一个指定key @param key string @return bool

func Dump

func Dump(key string) string

Dump 序列化给定key,并返回被序列化的值,使用Restore命令可以将这个值反序列化为Redis键 @param key string @return bool

func Exists

func Exists(key string) bool

Exists 判断一个指定key是否存在 @param key string @return bool

func Expire

func Expire(key string, expiration int64) bool

Expire 设置一个指定key的过期时间 @param key string @param expiration int64 @return bool

func ExpireAt

func ExpireAt(key string, timestamp time.Time) bool

ExpireAt 与Expire类似,都用于为key设置生存时间。但ExpireAt接受的时间参数是 UNIX 时间戳(unix timestamp) @param key string @param timestamp time.Time @return bool

func Get

func Get(key string) string

Get 获取一个指定key @param key string @return string

func HDel

func HDel(key string, fields ...string) bool

HDel 删除一个hash类型key的field @param key string @param fields ...string @return bool

func HExists

func HExists(key, field string) bool

HExists 判断一个hash类型key的field是否存在 @param key string @param field string @return bool

func HGet

func HGet(key, field string) string

HGet 获取一个hash类型key的field的值 @param key string @param field string @return string

func HGetAll

func HGetAll(key string) map[string]string

HGetAll 获取一个hash类型key的所有field和value @param key string @return map[string]string

func HIncrBy

func HIncrBy(key, field string, incr int64) (int64, error)

HIncrBy 增加一个hash类型key的field的值 @param key string @param field string @param incr int64 @return int64 @return bool

func HKeys

func HKeys(key string) []string

HKeys 获取一个hash类型key的所有field @param key string @return []string

func HLen

func HLen(key string) int64

HLen 获取一个hash类型key的field数量 @param key int64

func HMGetMap

func HMGetMap(key string, fields []string) map[string]interface{}

HMGetMap HMGet以map数据类型获取一个hash类型key的多个field的值 @param key string @param fields []string @return map[string]interface{}

func HMSet

func HMSet(key string, fieldValues map[string]interface{}) bool

HMSet 设置一个hash类型key的多个field和value @param key string @param fieldValues map[string]string @return bool

func HSet

func HSet(key, field string, value interface{}) bool

HSet 设置一个hash类型key的field的值 @param key string @param field string @param value string @return bool

func Incr

func Incr(key string) (int64, error)

Incr 将key中储存的数字值增一 @param key string @return int64 @return bool

func IncrBy

func IncrBy(key string, increment int64) (int64, error)

IncrBy 将key中储存的数字值增加increment @param key string @param increment int64 @return int64 @return bool

func IsExistTable

func IsExistTable(tableName string, databaseName string) bool

IsExistTable 判断表是否存在 @param tableName string @param databaseName string @return bool

func Keys

func Keys(pattern string) []string

Keys 查找所有符合给定模式 pattern 的 key * 匹配数据库中所有 key 。 h?llo 匹配hello,hallo和hxllo等。 h*llo 匹配 hllo和heeeeello等。 h[ae]llo 匹配hello和hallo,但不匹配 hillo @param pattern string @param []]string

func LIndex

func LIndex(key string, index int64) string

LIndex 通过索引获取列表中的元素 @param key string @param index int64 @return string

func LInsert

func LInsert(key, where, pivot, value string) (int64, error)

LInsert 在列表的元素前或后插入元素 @param key string @param where string before|after @param pivot string @param value string @return int64 @return bool

func LLen

func LLen(key string) int64

LLen 获取列表长度 @param key string @return int64

func LPop

func LPop(key string) string

LPop 从左侧移出并获取列表的第一个元素 @param key string @return string

func LPush

func LPush(key, value string) (int64, error)

LPush 向列表左侧添加元素 @param key string @param value string @return int64 @return bool

func LPushX

func LPushX(key, value string) (int64, error)

LPushX 向列表左侧添加元素,仅当列表中不存在该元素时,才插入 @param key string @param value string @return int64 @return bool

func LRange

func LRange(key string, start, stop int64) []string

LRange 获取列表指定范围内的元素 @param key string @param start int64 @param stop int64 @return []string

func LRem

func LRem(key string, count int64, value string) bool

LRem 根据参数count的值移除列表中与参数value相等的元素。count 的值可以是以下几种: 1、count > 0: 从表头开始向表尾搜索,移除与value相等的元素,数量为count 2、count < 0: 从表尾开始向表头搜索,移除与value相等的元素,数量为count的绝对值 3、count = 0: 移除表中所有与value相等的值 @param key string @param count int64 @return bool

func LSet

func LSet(key string, index int64, value string) bool

LSet 设置指定下标的元素值 @param key string @param index int64 @param value string @return bool

func MGetMap

func MGetMap(keys []string) map[string]interface{}

MGetMap MGet以map数据类型返回所有(一个或多个)给定key的值 @param keys []string @return map[string]interface{}

func MSet

func MSet(keyValues map[string]interface{}) bool

MSet 同时设置一个或多个key-value对 @param keyValues map[string]string @return bool

func MSetNX

func MSetNX(keyValues map[string]interface{}) bool

MSetNX 同时设置一个或多个key-value对,当且仅当所有给定 key 都不存在 @param keyValues map[string]string @return bool

func Move

func Move(key string, db int) bool

Move 将当前数据库的key移动到给定的数据库db当中 @param key string @param db int @return bool

func PExpire

func PExpire(key string, timeout time.Duration) bool

PExpire 与Expire作用类似,但是它以毫秒为单位设置key的生存时间,而不像Expire以秒为单位 @param key string @param timeout time.Duration @return bool

func PExpireAt

func PExpireAt(key string, timestamp time.Time) bool

PExpireAt 与ExpireAt命令类似,但它以毫秒为单位设置key的过期unix时间戳,而不是像ExpireAt以秒为单位

func PTTL

func PTTL(key string) time.Duration

PTTL 与TTL类似,但它以毫秒为单位返回key剩余生存时间,而不是像TTL以秒为单位 @param key string @return int64

func Persist

func Persist(key string) bool

Persist 移除给定 key 的生存时间,将这个 key 从『易失的』(带生存时间 key )转换成『持久的』(一个不带生存时间、永不过期的 key ) @param key string @return bool

func RPop

func RPop(key string) string

RPop 从右侧移出并获取列表的第一个元素 @param key string @return string

func RPopLPush

func RPopLPush(source, destination string, timeout int64) string

RPopLPush 在一个原子时间内,执行以下两个动作: 1、将列表 source 中的最后一个元素(从右侧)弹出,并返回给客户端。 2、将 source 弹出的元素插入(向左侧)到列表destination,作为destination列表的的头元素 @param source string @param destination string @param timeout int64

func RPush

func RPush(key, value string) (int64, error)

RPush 向列表右侧添加元素 @param key string @param value string @return int64 @return error

func RPushX

func RPushX(key, value string) (int64, error)

RPushX 向列表左侧添加元素,仅当列表中不存在该元素时,才插入 @param key string @param value string @return int64 @return bool

func Rename

func Rename(key, newKey string) bool

Rename 将key改名为newKey @param key string @param newKey string @return bool

func RenameNX

func RenameNX(key, newKey string) bool

RenameNX 当且仅当newKey不存在时,将key改名为newKey @param key string @param newKey string @return bool

func Restore

func Restore(key string, ttl int64, value string) string

Restore 反序列化给定的序列化值,并将它和给定的key关联 @param key string @param ttl int64 @param value string @return string

func SAdd

func SAdd(key string, members []string) (int64, error)

SAdd 将一个或多个member元素加入到集合key当中,已经存在于集合的member元素将被忽略 @param key string @param members []string @return int64 @return error

func SCard

func SCard(key string) int64

SCard 返回集合key的基数(集合中元素的数量) @param key string @return int64

func SDiff

func SDiff(keys ...string) []string

SDiff 返回一个集合的全部成员,该集合是所有给定集合之间的差集 @param keys ...string @return []string

func SDiffStore

func SDiffStore(destination string, keys ...string) bool

SDiffStore 与SDiff类似,但它将结果保存到destination集合 如果destination集合已经存在,则将其覆盖 destination可以是key本身 @param destination string @param keys ...string @return bool

func SInter

func SInter(keys ...string) []string

SInter 返回一个集合的全部成员,该集合是所有给定集合的交集 @param keys []string @return []string

func SInterStore

func SInterStore(destination string, keys ...string) bool

SInterStore 与SInter类似,但它将结果保存到destination集合 如果destination集合已经存在,则将其覆盖 destination可以是key本身 @param destination string @param keys ...string @return bool

func SIsMember

func SIsMember(key string, member string) bool

SIsMember 判断member元素是否集合key的成员 @param key string @param member string @return bool

func SMembers

func SMembers(key string) []string

SMembers 返回集合 key 中的所有成员 @param key string @return []string

func SMove

func SMove(key, destination, member string) bool

SMove 将member元素从source集合移动到destination集合 @param key string @param destination string @return bool

func SRem

func SRem(key string, members []interface{}) bool

SRem 移除集合key中的一个或多个member元素,不存在的member元素会被忽略 @param key string @param members []interface @return bool

func SUnion

func SUnion(keys ...string) []string

SUnion 返回一个集合的全部成员,该集合是所有给定集合的并集 @param keys ...string @return []string

func SUnionStore

func SUnionStore(destination string, keys ...string) bool

SUnionStore 类似于SUnion命令,但它将结果保存到destination集合 @param destination string @param keys ...string @return bool

func Set

func Set(key string, value interface{}, expiration int64) bool

Set 给指定key设置value @param key string @param value string @param expiration int64 @return bool

func SetNX

func SetNX(key string, value interface{}, expiration int64) bool

SetNX 给指定key设置value,当且仅当 key 不存在 @param key string @param value string @param expiration int64 @return bool

func StrLen

func StrLen(key string) int64

StrLen 返回key所储存的字符串值的长度 @param key string @return int64

func TTL

func TTL(key string) int64

TTL 获取一个指定key的过期时间 @param key string @return int64

func Type

func Type(key string) string

Type 返回 key 所储存的值的类型 @param key string @return string

func ZAdd

func ZAdd(key string, members map[interface{}]int64) bool

ZAdd 将一个或多个member元素及其score值加入到有序集key当中 @param key string @param members map[interface{}]int64 @return bool

func ZCard

func ZCard(key string) int64

ZCard 返回有序集key的基数 @param key string @return int64

func ZCount

func ZCount(key, min, max string) int64

ZCount 返回有序集key中,score 值在min和max之间(默认包括score值等于min或max)的成员的数量 @param key string @param min string @param max string @return int64

func ZIncrBy

func ZIncrBy(key string, increment int64, member string) (int64, error)

ZIncrBy 为有序集key的成员member的score值加上增量increment @param key string @param increment int64 @param member string @return int64 @return error

func ZRange

func ZRange(key string, start, stop int64) []string

ZRange 返回有序集key中,指定区间内的成员。 其中成员的位置按score值递增(从小到大)来排序。 具有相同score值的成员按字典序(lexicographical order )来排列 @param key string @param start int64 @param stop int64 @return []string

func ZRangeByScore

func ZRangeByScore(key string, opt *redis.ZRangeBy) []string

ZRangeByScore 返回有序集ey中所有score 值介于min和max 之间(包括等于min或max)的成员。有序集成员按score值递增(从小到大)次序排列 具有相同 score 值的成员按字典序(lexicographical order)来排列(该属性是有序集提供的,不需要额外的计算) @param key string @param opt *redis.ZRangeBy @return []string

func ZRank

func ZRank(key, member string) int64

ZRank 返回有序集 key 中成员 member 的排名。 其中有序集成员按 score 值递增(从小到大)顺序排列 @param key string @param member string @return int64

func ZRem

func ZRem(key string, members []string) bool

ZRem 移除有序集key中的一个或多个成员,不存在的成员将被忽略 @param key string @param members []string @return bool

func ZRemRangeByRank

func ZRemRangeByRank(key string, start, stop int64) bool

ZRemRangeByRank 移除有序集key中指定排名(rank)区间内的所有成员 @param key string @param opt *redis.ZRangeBy @return bool

func ZRemRangeByScore

func ZRemRangeByScore(key, min, max string) bool

ZRemRangeByScore 移除有序集key中指定分数(score)区间内的所有成员 @param key string @param min string @param max string @return bool

func ZRevRange

func ZRevRange(key string, start, stop int64) []string

ZRevRange 返回有序集key中,指定区间内的成员。 其中成员的位置按score值递减(从大到小)来排列。 具有相同score值的成员按字典序的逆序(reverse lexicographical order)排列。 @param key string @param start int64 @param stop int64 @return []string

func ZRevRangeByLex

func ZRevRangeByLex(key string, opt *redis.ZRangeBy) []string

ZRevRangeByLex 返回有序集key中指定区间内的成员。其中成员的位置按score值递减(从大到小)来排列 @param key string @param opt *redis.ZRangeBy @return []string

func ZRevRangeByScore

func ZRevRangeByScore(key string, opt *redis.ZRangeBy) []string

ZRevRangeByScore 返回有序集key中指定区间内的成员。其中成员的位置按score值递减(从大到小)来排列 @param key string @param opt *redis.ZRangeBy @return []string

func ZRevRangeByScoreWithScores

func ZRevRangeByScoreWithScores(key string, opt *redis.ZRangeBy) []redis.Z

ZRevRangeByScoreWithScores 返回有序集key中指定区间内的成员。其中成员的位置按score值递减(从大到小)来排列 @param key string @param opt *redis.ZRangeBy @return []redis.Z

func ZRevRangeWithScores

func ZRevRangeWithScores(key string, start, stop int64) []redis.Z

ZRevRangeWithScores 返回有序集key中指定区间内的成员。其中成员的位置按score值递减(从大到小)来排列 @param key string @param start int64 @param stop int64 @return []redis.Z

func ZRevRank

func ZRevRank(key, member string) int64

ZRevRank 返回有序集key中成员member的排名。其中有序集成员按score值递减(从大到小)排序 @param key string @param member string @return int64

func ZScore

func ZScore(key, member string) int64

ZScore 返回有序集key中成员member的score值

Types

type Mysql

type Mysql struct {
	Id  int
	Pre string
	Ng  string
	Ser string
	Th  string `orm:"size(500)"`
}

Jump to

Keyboard shortcuts

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