2022-01-19 19:51:08 +00:00
|
|
|
package backend
|
|
|
|
|
|
|
|
import "github.com/ChronosX88/yans/internal/models"
|
|
|
|
|
|
|
|
const (
|
|
|
|
SupportedBackendList = "sqlite"
|
|
|
|
)
|
|
|
|
|
|
|
|
type StorageBackend interface {
|
|
|
|
ListGroups() ([]models.Group, error)
|
2022-01-20 21:29:58 +00:00
|
|
|
ListGroupsByPattern(pattern string) ([]models.Group, error)
|
2022-01-25 16:27:58 +00:00
|
|
|
GetGroup(groupName string) (models.Group, error)
|
2022-01-25 21:29:30 +00:00
|
|
|
GetNewGroupsSince(timestamp int64) ([]models.Group, error)
|
2022-02-03 17:39:08 +00:00
|
|
|
GetArticlesCount(g *models.Group) (int, error)
|
|
|
|
GetGroupLowWaterMark(g *models.Group) (int, error)
|
|
|
|
GetGroupHighWaterMark(g *models.Group) (int, error)
|
2022-02-03 16:44:08 +00:00
|
|
|
SaveArticle(article models.Article, groups []string) error
|
|
|
|
GetArticle(messageID string) (models.Article, error)
|
2022-02-05 10:51:50 +00:00
|
|
|
GetArticleByNumber(g *models.Group, num int) (models.Article, error)
|
2022-02-03 17:39:08 +00:00
|
|
|
GetArticleNumbers(g *models.Group, low, high int64) ([]int64, error)
|
2022-02-05 15:42:23 +00:00
|
|
|
GetNewArticlesSince(timestamp int64) ([]string, error)
|
2022-02-05 16:19:43 +00:00
|
|
|
GetLastArticleByNum(g *models.Group, a *models.Article) (models.Article, error)
|
2022-02-05 16:23:20 +00:00
|
|
|
GetNextArticleByNum(g *models.Group, a *models.Article) (models.Article, error)
|
2022-02-05 18:31:22 +00:00
|
|
|
GetArticlesByRange(g *models.Group, low, high int64) ([]models.Article, error)
|
2022-04-14 21:31:03 +00:00
|
|
|
GetNewThreads(g *models.Group, perPage int, pageNum int) ([]int, error)
|
2022-01-19 19:51:08 +00:00
|
|
|
}
|