db

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: GPL-3.0 Imports: 12 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")
)
View Source
var (
	ErrTimezoneAlreadyExists = errors.New("timezone already exists")
	ErrNoTimezonesFound      = errors.New("no timezones found")
	ErrTimezoneDoesntExist   = errors.New("timezone doesn't exist")
)

Functions

This section is empty.

Types

type DB

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

func New

func New(path string) (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) GetTimezones added in v0.3.0

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

func (*DB) NewTag

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

func (*DB) NewTimezone added in v0.3.0

func (db *DB) NewTimezone(ctx context.Context, chatID int64, username, tz, description 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) RemoveTimezone added in v0.3.0

func (db *DB) RemoveTimezone(ctx context.Context, chatID int64, username 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_tags_chatid_name,unique"`
	Name        string `gorm:"index:idx_tags_chatid_name,unique"`
	Description string
	Mentions    string
}

type Timezone added in v0.3.0

type Timezone struct {
	gorm.Model
	ChatID      int64  `gorm:"index:idx_timezones_chatid_username,unique"`
	Username    string `gorm:"index:idx_timezones_chatid_username,unique"`
	Timezone    string
	Description string
}

Jump to

Keyboard shortcuts

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