storage

package
v0.0.0-...-eb336c4 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IChatState = "IChatState"

Functions

func Get

func Get(db *badger.DB, key string) []byte

func GetRaw

func GetRaw(db *badger.DB, key []byte) []byte

func OpenDB

func OpenDB(customPath string, dbPath string) *badger.DB

func Set

func Set(db *badger.DB, key string, value []byte)

func SetWithTTL

func SetWithTTL(db *badger.DB, key string, value []byte, ttl time.Duration)

Types

type Config

type Config struct {
	Internal InternalConfig
}

func ReadConfig

func ReadConfig(data *Data) *Config

type Data

type Data struct {
	Log       *zap.Logger
	Chat      *tb.Chat
	DB        *badger.DB
	Config    *Config
	MediaPath string
	R         *sqlx.DB
	Cache     caching.Cache
}

func (*Data) DeleteVar

func (d *Data) DeleteVar(projectName, key string)

func (*Data) GetLog

func (d *Data) GetLog(key string) []byte

You need to unmarshal it yourself.

func (*Data) GetLogRaw

func (d *Data) GetLogRaw(key []byte) []byte

func (*Data) GetVar

func (d *Data) GetVar(projectName, key string) []byte

func (*Data) InternalAlert

func (d *Data) InternalAlert(message string)

func (*Data) NewIssue

func (d *Data) NewIssue(projectID, env, service, timestamp, key, flag string)

func (*Data) ProjectAlert

func (d *Data) ProjectAlert(project, message string)

func (*Data) SetLog

func (d *Data) SetLog(key string, obj interface{}, ttl time.Duration)

You do not need to marshal anything!

func (*Data) SetVar

func (d *Data) SetVar(projectName, key string, obj interface{}, ttl time.Duration)

func (*Data) VarExists

func (d *Data) VarExists(projectName, key string) bool

type InternalConfig

type InternalConfig struct {
	TG struct {
		BotToken   string `yaml:"bot_token"`
		BossChatID int64  `yaml:"boss_chat_id"`
	} `yaml:"tg"`
	JWTExpHours int `yaml:"jwt_exp_hours"`
	Log         struct {
		ClearOnRestart      bool    `yaml:"clear_on_restart"`
		ServiceHostname     string  `yaml:"service_hostname"`
		RetentionHours      int     `yaml:"retention_hours"`
		SimilarityThreshold float64 `yaml:"similarity_threshold"`
	} `yaml:"log"`
}

func ReadInternalConfig

func ReadInternalConfig(path string) (InternalConfig, error)

Jump to

Keyboard shortcuts

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