redis

package
v0.0.0-...-b5cca38 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const BucketNameSeparator = " - "

BucketNameSeparator string used for concatting chatID with user defined name to form bucket names

Variables

This section is empty.

Functions

This section is empty.

Types

type Redis

type Redis struct {
	Client *redis.Client
}

Redis abstraction for redis database

func NewInstance

func NewInstance(connectionString string) (*Redis, error)

NewInstance get new instance of Redis database

func (*Redis) DefaultWasSet

func (r *Redis) DefaultWasSet(chatID int64) (bool, error)

DefaultWasSet check if a default bucket set for a chat

func (*Redis) DeleteBucket

func (r *Redis) DeleteBucket(chatID int64, bucketName string) error

DeleteBucket remove a bucket from database

func (*Redis) DeleteOption

func (r *Redis) DeleteOption(chatID int64, bucketName string, optionIdx int64) ([]domain.Option, error)

DeleteOption remove an option from a bucket

func (*Redis) Exists

func (r *Redis) Exists(chatID int64, bucketName string) (bool, error)

Exists check if a bucket exists in database

func (*Redis) GetAllBuckets

func (r *Redis) GetAllBuckets(chatID int64) ([]domain.Bucket, error)

GetAllBuckets get all buckets in a chat

func (*Redis) GetDefaultBucket

func (r *Redis) GetDefaultBucket(chatID int64) (string, error)

GetDefaultBucket get the default bucket of current chat

func (*Redis) InsertBucket

func (r *Redis) InsertBucket(chatID int64, name string) error

InsertBucket create a new options bucket

func (*Redis) InsertOption

func (r *Redis) InsertOption(chatID int64, bucketName string, option domain.Option) error

InsertOption put an option inside a bucket

func (*Redis) ReadAllOptions

func (r *Redis) ReadAllOptions(chatID int64, bucketName string) ([]domain.Option, error)

ReadAllOptions query all options inside a bucket

func (*Redis) UpdateDefaultBucket

func (r *Redis) UpdateDefaultBucket(chatID int64, bucketName string) error

UpdateDefaultBucket change the default bucket for chat to draw from

Jump to

Keyboard shortcuts

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