storage

package
v0.0.0-...-e14e005 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Abonnement

type Abonnement struct {
	Feed
	Chats []Chat
}

type AbonnementStorage

type AbonnementStorage interface {
	Create(chatId int64, chatTitle string, feedUrl string, lastEntry *string) error
	Delete(chatId int64, feedId int64) error
	ExistsByFeedUrl(chatId int64, feedUrl string) (bool, error)
	ExistsById(chatId int64, feedId int64) (bool, error)
	GetByUser(chatId int64) ([]Feed, error)
	GetAll() ([]Abonnement, error)
	SetLastEntry(feedUrl string, lastEntry *string) error
}

type Abonnements

type Abonnements struct {
	*sqlx.DB
}

func (*Abonnements) Create

func (db *Abonnements) Create(chatId int64, chatTitle string, feedUrl string, lastEntry *string) error

func (*Abonnements) Delete

func (db *Abonnements) Delete(chatId int64, feedId int64) error

func (*Abonnements) ExistsByFeedUrl

func (db *Abonnements) ExistsByFeedUrl(chatId int64, feedUrl string) (bool, error)

func (*Abonnements) ExistsById

func (db *Abonnements) ExistsById(chatId int64, feedId int64) (bool, error)

func (*Abonnements) GetAll

func (db *Abonnements) GetAll() ([]Abonnement, error)

func (*Abonnements) GetByUser

func (db *Abonnements) GetByUser(chatId int64) ([]Feed, error)

func (*Abonnements) SetLastEntry

func (db *Abonnements) SetLastEntry(feedUrl string, lastEntry *string) error

type Chat

type Chat struct {
	ID        int64     `db:"chat_id"`
	Title     string    `db:"title"`
	CreatedAt time.Time `db:"chat_created_at"`
}

type DB

type DB struct {
	*sqlx.DB
	Abonnements  AbonnementStorage
	Replacements ReplacementsStorage
}

func Connect

func Connect() (*DB, error)

func (*DB) Migrate

func (db *DB) Migrate() (int, error)

type Feed

type Feed struct {
	ID        int64          `db:"id"`
	Url       string         `db:"url"`
	LastEntry sql.NullString `db:"last_entry"`
	CreatedAt time.Time      `db:"created_at"`
	UpdatedAt sql.NullTime   `db:"updated_at"`
}

func (Feed) Check

func (feedToCheck Feed) Check(lastEntry *string) (*gofeed.Feed, error)

type Replacement

type Replacement struct {
	ID        int64     `db:"id"`
	Value     string    `db:"value"`
	IsRegex   bool      `db:"is_regex"`
	CreatedAt time.Time `db:"created_at"`
}

type Replacements

type Replacements struct {
	*sqlx.DB
}

func (*Replacements) Create

func (db *Replacements) Create(value string, isRegex bool) error

func (*Replacements) Delete

func (db *Replacements) Delete(replacementId int64) error

func (*Replacements) List

func (db *Replacements) List() ([]Replacement, error)

type ReplacementsStorage

type ReplacementsStorage interface {
	Create(value string, isRegex bool) error
	Delete(replacementId int64) error
	List() ([]Replacement, error)
}

Jump to

Keyboard shortcuts

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