db

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTagAlreadyExists  = errors.New("tag already exists")
	ErrNoTagsFound       = errors.New("no tags found")
	ErrTagDoesntExist    = errors.New("tag doesn't exist")
	ErrEmptyTag          = errors.New("tag is now empty, removing it")
	ErrUsersAlreadyInTag = errors.New("provided users are already mentioned by the tag")
	ErrUsersNotInTag     = errors.New("provided users are not mentioned by the tag")
)

Functions

This section is empty.

Types

type DB

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

func New

func New(c *config.Config) (DB, error)

func (*DB) AddMentionsToTag

func (db *DB) AddMentionsToTag(ctx context.Context, chatID int64, name string, mentions ...string) error

func (*DB) ChangeDescriptionOfTag added in v0.2.0

func (db *DB) ChangeDescriptionOfTag(ctx context.Context, chatID int64, name, description string) error

func (*DB) GetTags

func (db *DB) GetTags(ctx context.Context, chatID int64) ([]Tag, error)

func (*DB) NewTag

func (db *DB) NewTag(ctx context.Context, chatID int64, name, description string, mentions ...string) error

func (*DB) RemoveMentionsFromTag

func (db *DB) RemoveMentionsFromTag(ctx context.Context, chatID int64, name string, mentions ...string) error

func (*DB) RemoveTag

func (db *DB) RemoveTag(ctx context.Context, chatID int64, name string) error

func (*DB) RenameTag

func (db *DB) RenameTag(ctx context.Context, chatID int64, oldName, newName string) error

type Tag

type Tag struct {
	gorm.Model
	ChatID      int64  `gorm:"index:idx_chatid_name,unique"`
	Name        string `gorm:"index:idx_chatid_name,unique"`
	Description string
	Mentions    string
}

Jump to

Keyboard shortcuts

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