package idec import ( "errors" "gitrepo.ru/neonxp/idecnode/pkg/config" "go.etcd.io/bbolt" ) var Features = []string{"list.txt", "blacklist.txt", "u/e", "u/m", "x/c", "m", "e"} var ( ErrUserNotFound = errors.New("user not found") ErrMessageNotFound = errors.New("message not found") ErrFailedSaveMessage = errors.New("- failed save message") ErrWrongMessageFormat = errors.New("- wrong message format") ErrNoAuth = errors.New("no auth - wrong authstring") ) const ( msgBucket = "_msg" points = "_points" ) type IDEC struct { config *config.Config db *bbolt.DB } func New(config *config.Config) (*IDEC, error) { db, err := bbolt.Open(config.Store, 0o600, nil) if err != nil { return nil, err } return &IDEC{ config: config, db: db, }, nil } func (i *IDEC) Close() error { return i.db.Close() } func max(x, y int) int { if x > y { return x } return y }