storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnString

func NewConnString(host, user, pass, dbname string, port int, kw KW) string

func WrapLogrus added in v0.1.1

func WrapLogrus(log *logrus.Logger) *logger

Types

type KW

type KW map[string]interface{}

type Logger added in v0.1.1

type Logger interface {
	Print(...interface{})
}

type Postgres

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

func NewPostgres

func NewPostgres(conn string, logger Logger) (*Postgres, error)

func (*Postgres) GetChatsRating added in v0.1.1

func (p *Postgres) GetChatsRating() ([]model.ChatStatistics, error)

func (*Postgres) GetGlobalRating

func (p *Postgres) GetGlobalRating() ([]model.UserInChat, error)

func (*Postgres) GetRating

func (p *Postgres) GetRating(chatID int64) ([]model.UserInChat, error)

func (*Postgres) GetStatistics

func (p *Postgres) GetStatistics() (model.Statistics, error)

func (*Postgres) IncrementUserStats

func (p *Postgres) IncrementUserStats(chat model.Chat, givenUser ...model.UserInChat) error

type Redis added in v0.1.1

type Redis struct {
	Pool *redis.Pool
}

func NewRedis added in v0.1.1

func NewRedis(p *redis.Pool) *Redis

func (*Redis) LookupForMachine added in v0.1.1

func (r *Redis) LookupForMachine(m *crocodile.Machine) error

LookupForMachine will take machine from Redis and unmarshal json to m argument

func (*Redis) SaveMachineState added in v0.1.1

func (r *Redis) SaveMachineState(m crocodile.Machine) error

type Storage added in v0.1.1

type Storage struct {
	*Postgres
	*Redis
}

func NewStorage added in v0.1.1

func NewStorage(conn string, pool *redis.Pool, logger Logger) (*Storage, error)

Jump to

Keyboard shortcuts

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