goutlis

package module
v0.0.0-...-5d7f966 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2019 License: MIT Imports: 11 Imported by: 0

README

goutlis

go utils

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesEncrypt

func AesEncrypt(origData []byte, keyString string) ([]byte, error)

AesEncrypt 加密 CBC 128位

func HashPassword

func HashPassword(pwd string) (string, error)

HashPassword 计算密码hash值

func MD5

func MD5(text string) string

MD5 MD5

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

PKCS7Padding 补码填充

func RandString

func RandString(lenght int64) string

RandString 生成随机字符串

func VerifyPassword

func VerifyPassword(pwd string, hash string) bool

VerifyPassword 验证密码

Types

type CircularQueue

type CircularQueue struct {
	sync.RWMutex // 读写锁
	// contains filtered or unexported fields
}

CircularQueue 循环队列

func InitCircularQueue

func InitCircularQueue(lenght int) (queue *CircularQueue, err error)

InitCircularQueue 初始化队列

func (*CircularQueue) Dequeue

func (q *CircularQueue) Dequeue() (item interface{}, err error)

Dequeue 出队

func (*CircularQueue) Enqueue

func (q *CircularQueue) Enqueue(item interface{}) error

Enqueue 入队

func (*CircularQueue) IsEmpty

func (q *CircularQueue) IsEmpty() bool

IsEmpty 是否空

func (*CircularQueue) IsFull

func (q *CircularQueue) IsFull() bool

IsFull 是否满

func (*CircularQueue) Lenght

func (q *CircularQueue) Lenght() int

Lenght 获取当前队列长度

type LinkQueue

type LinkQueue struct {
	SinglyList
}

LinkQueue 链表队列

func (*LinkQueue) Dequeue

func (q *LinkQueue) Dequeue() (item interface{}, err error)

Dequeue 出队

func (*LinkQueue) Enqueue

func (q *LinkQueue) Enqueue(item interface{}) error

Enqueue 入队

type Redis

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

Redis Redis结构

func InitRedis

func InitRedis(conf *RedisConfig) *Redis

InitRedis Redis初始化

func (*Redis) Delete

func (r *Redis) Delete(key string) (int64, error)

Delete Key删除

func (*Redis) Exists

func (r *Redis) Exists(key string) (bool, error)

Exists Key存在

func (*Redis) Expire

func (r *Redis) Expire(key string, ex int64) (int64, error)

Expire 设置过期时间

func (*Redis) Get

func (r *Redis) Get(key string) ([]byte, error)

Get 获取值

func (*Redis) Keys

func (r *Redis) Keys(key string) ([]string, error)

Keys 查询列表

func (*Redis) Set

func (r *Redis) Set(key string, content interface{}, ex ...int64) (string, error)

Set 设置值

type RedisConfig

type RedisConfig struct {
	Address     string
	Password    string
	Db          string
	MaxIdle     int           // 最大空闲连接数
	MaxActive   int           // 最大连接数
	IdleTimeout time.Duration // 空闲连接超时时间
	Wait        bool          // 如果超过最大连接,是否等待,不等待则报错
}

RedisConfig Redis配置信息

type SinglyList

type SinglyList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SinglyList 单向链表

func (*SinglyList) Append

func (list *SinglyList) Append(item interface{}) error

Append 追加数据

func (*SinglyList) Clear

func (list *SinglyList) Clear()

Clear 清空链表

func (*SinglyList) Get

func (list *SinglyList) Get(index int) (item interface{}, err error)

Get 查找元素

func (*SinglyList) InsertAt

func (list *SinglyList) InsertAt(index int, item interface{}) error

InsertAt 插入数据

func (*SinglyList) Lenght

func (list *SinglyList) Lenght() int

Lenght 当前长度

func (*SinglyList) Remove

func (list *SinglyList) Remove(index int) (interface{}, error)

Remove 移除元素

Jump to

Keyboard shortcuts

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