db

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCleanupDatabaseJob added in v0.2.0

func NewCleanupDatabaseJob(db DB) job.Job

NewCleanupDatabaseJob create and start new job to clean the database

Types

type ArticleRepository

type ArticleRepository interface {
	CountArticles(status string) (uint, error)
	CountArticlesByUser(uid uint, req model.ArticlesPageRequest) (uint, error)
	GetPaginatedArticlesByUser(uid uint, req model.ArticlesPageRequest) (*model.ArticlesPageResponse, error)
	GetArticleByID(id uint) (*model.Article, error)
	CreateArticleForUser(uid uint, form model.ArticleCreateForm) (*model.Article, error)
	UpdateArticleForUser(uid uint, form model.ArticleUpdateForm) (*model.Article, error)
	MarkAllArticlesAsReadByUser(uid uint, status string, categoryID *uint) (int64, error)
	DeleteArticle(id uint) error
	DeleteReadArticlesOlderThan(delay time.Duration) (int64, error)
	DeleteAllReadArticlesByUser(uid uint) (int64, error)
}

ArticleRepository is the repository interface to manage Articles

type CategoryRepository

type CategoryRepository interface {
	GetCategoryByID(id uint) (*model.Category, error)
	GetCategoryByUserAndTitle(uid uint, title string) (*model.Category, error)
	GetCategoriesByUser(uid uint) ([]model.Category, error)
	CountCategoriesByUser(uid uint) (uint, error)
	CreateCategoryForUser(uid uint, form model.CategoryCreateForm) (*model.Category, error)
	UpdateCategoryForUser(uid uint, form model.CategoryUpdateForm) (*model.Category, error)
	DeleteCategoryByUser(uid uint, ID uint) error
	DeleteCategoriesByUser(uid uint, ids []uint) (int64, error)
}

CategoryRepository is the repository interface to manage categories

type CleanupDatabaseJob added in v0.2.0

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

CleanupDatabaseJob is a job to clean the database

func (*CleanupDatabaseJob) Start added in v0.2.0

func (cdj *CleanupDatabaseJob) Start()

Start the cleanup job

func (*CleanupDatabaseJob) Stop added in v0.2.0

func (cdj *CleanupDatabaseJob) Stop()

Stop the cleanup job

type DB

DB is the global database structure

func NewDB

func NewDB(conn string) (DB, error)

NewDB create new database provider regarding the datasource URI

type DeviceRepository

type DeviceRepository interface {
	GetDeviceByID(id uint) (*model.Device, error)
	GetDeviceByUserAndKey(uid uint, key string) (*model.Device, error)
	GetDevicesByUser(uid uint) ([]model.Device, error)
	CountDevicesByUser(uid uint) (uint, error)
	CreateDevice(device model.Device) (*model.Device, error)
	DeleteDevice(id uint) error
	DeleteDevicesByUser(uid uint, ids []uint) (int64, error)
	DeleteInactiveDevicesOlderThan(delay time.Duration) (int64, error)
}

DeviceRepository is the repository interface to manage Devices

type IncomingWebhookRepository

type IncomingWebhookRepository interface {
	GetIncomingWebhookByID(id uint) (*model.IncomingWebhook, error)
	GetIncomingWebhookByToken(token string) (*model.IncomingWebhook, error)
	GetIncomingWebhookByUserAndAlias(uid uint, alias string) (*model.IncomingWebhook, error)
	GetIncomingWebhooksByUser(uid uint) ([]model.IncomingWebhook, error)
	CountIncomingWebhooksByUser(uid uint) (uint, error)
	CreateIncomingWebhookForUser(uid uint, form model.IncomingWebhookCreateForm) (*model.IncomingWebhook, error)
	UpdateIncomingWebhookForUser(uid uint, form model.IncomingWebhookUpdateForm) (*model.IncomingWebhook, error)
	DeleteIncomingWebhookByUser(uid uint, id uint) error
	DeleteIncomingWebhooksByUser(uid uint, ids []uint) (int64, error)
}

IncomingWebhookRepository is the repository interface to manage incoming webhooks

type OutgoingWebhookRepository

type OutgoingWebhookRepository interface {
	GetOutgoingWebhookByID(id uint) (*model.OutgoingWebhook, error)
	GetOutgoingWebhookByUserAndAlias(uid uint, alias *string) (*model.OutgoingWebhook, error)
	GetOutgoingWebhooksByUser(uid uint) ([]model.OutgoingWebhook, error)
	CountOutgoingWebhooksByUser(uid uint) (uint, error)
	CreateOutgoingWebhookForUser(uid uint, form model.OutgoingWebhookCreateForm) (*model.OutgoingWebhook, error)
	UpdateOutgoingWebhookForUser(uid uint, form model.OutgoingWebhookUpdateForm) (*model.OutgoingWebhook, error)
	DeleteOutgoingWebhookByUser(uid uint, id uint) error
	DeleteOutgoingWebhooksByUser(uid uint, ids []uint) (int64, error)
	ManageOutgoingWebhookSecrets(ctx context.Context, provider secret.EngineProvider, action secret.Action) (uint, error)
}

OutgoingWebhookRepository is the repository interface to manage outgoing webhooks

type PropertiesRepository

type PropertiesRepository interface {
	CreateProperties(properties model.Properties) (*model.Properties, error)
	GetProperties() (*model.Properties, error)
}

PropertiesRepository is the repository interface to manage Propertiess

type UserRepository

type UserRepository interface {
	GetUserByID(id uint) (*model.User, error)
	GetUserByUsername(username string) (*model.User, error)
	CreateOrUpdateUser(user model.User) (*model.User, error)
	DeleteUser(user model.User) error
	CountUsers() (uint, error)
}

UserRepository is the repository interface to manage Users

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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