db

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists error = fmt.Errorf("already exists")

Functions

This section is empty.

Types

type Database

type Database interface {
	GetLastUpdateTime(url, filter string) time.Time
	GetLastTag(url, filter string) string
	UpdateLastUpdateTime(url, filter, tag string, t time.Time)

	AddFeed(name, repo, filter, messagePattern string) (int, error)
	GetFeed(name string) (*Feed, error)
	ListFeeds() ([]*Feed, error)
	RemoveFeed(name, repo, filter, messagePattern string) error

	// Subscriptions
	AddSubscribtion(endpoint, url, filter string, chatID int64) error
	RemoveSubscribtion(endpoint, url, filter string, chatID int64) error

	// Maintenance
	UpdateChatID(oldChatID, newChatID int64) error

	// Notification methods
	GetNotificationMethods(url, filter string) ([]string, error)

	// Endpoints
	GetEndpointInfo(endpoint, url, filter string) ([]int64, error)

	// Resend Queue
	AddMessagesToResentQueue(messages []*types.NotificationMessage) error
	GetMessagesFromResentQueue() ([]*types.NotificationMessage, error)
}

func NewSQLite

func NewSQLite() Database

type Feed

type Feed struct {
	Id             int
	Repo           string
	Filter         string
	Name           string
	MessagePattern string
}

type SQLite

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

func (*SQLite) AddFeed

func (d *SQLite) AddFeed(name, repo, filter, messagePattern string) (int, error)

func (*SQLite) AddMessagesToResentQueue added in v0.0.2

func (db *SQLite) AddMessagesToResentQueue(messages []*types.NotificationMessage) error

func (*SQLite) AddSubscribtion

func (d *SQLite) AddSubscribtion(endpoint, url, filter string, chatID int64) error

func (*SQLite) GetEndpointInfo

func (d *SQLite) GetEndpointInfo(endpoint, url, filter string) ([]int64, error)

func (*SQLite) GetFeed

func (d *SQLite) GetFeed(name string) (*Feed, error)

func (*SQLite) GetLastTag

func (d *SQLite) GetLastTag(url, filter string) string

GetLastTag - gets Last Tag

func (*SQLite) GetLastUpdateTime

func (d *SQLite) GetLastUpdateTime(url, filter string) time.Time

GetLastUpdateTime - gets Last Update Time

func (*SQLite) GetMessagesFromResentQueue added in v0.0.2

func (db *SQLite) GetMessagesFromResentQueue() ([]*types.NotificationMessage, error)

func (*SQLite) GetNotificationMethods

func (d *SQLite) GetNotificationMethods(url, filter string) ([]string, error)

func (*SQLite) ListFeeds

func (d *SQLite) ListFeeds() ([]*Feed, error)

func (*SQLite) RemoveFeed added in v0.0.2

func (d *SQLite) RemoveFeed(name, repo, filter, messagePattern string) error

func (*SQLite) RemoveSubscribtion

func (d *SQLite) RemoveSubscribtion(endpoint, url, filter string, chatID int64) error

func (*SQLite) UpdateChatID added in v0.0.2

func (d *SQLite) UpdateChatID(oldChatID, newChatID int64) error

func (*SQLite) UpdateLastUpdateTime

func (d *SQLite) UpdateLastUpdateTime(url, filter, tag string, t time.Time)

Jump to

Keyboard shortcuts

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