Documentation
¶
Index ¶
- func Migrate(db *sql.DB)
- type DB
- func (pg *DB) Close() error
- func (pg *DB) CountArticles(status string) (uint, error)
- func (pg *DB) CountArticlesByUser(uid uint, req model.ArticlesPageRequest) (uint, error)
- func (pg *DB) CountCategoriesByUser(uid uint) (uint, error)
- func (pg *DB) CountDevicesByUser(uid uint) (uint, error)
- func (pg *DB) CountIncomingWebhooksByUser(uid uint) (uint, error)
- func (pg *DB) CountOutgoingWebhooksByUser(uid uint) (uint, error)
- func (pg *DB) CountUsers() (uint, error)
- func (pg *DB) CreateArticleForUser(uid uint, form model.ArticleCreateForm) (*model.Article, error)
- func (pg *DB) CreateCategoryForUser(uid uint, form model.CategoryCreateForm) (*model.Category, error)
- func (pg *DB) CreateDevice(device model.Device) (*model.Device, error)
- func (pg *DB) CreateIncomingWebhookForUser(uid uint, form model.IncomingWebhookCreateForm) (*model.IncomingWebhook, error)
- func (pg *DB) CreateOrUpdateUser(user model.User) (*model.User, error)
- func (pg *DB) CreateOutgoingWebhookForUser(uid uint, form model.OutgoingWebhookCreateForm) (*model.OutgoingWebhook, error)
- func (pg *DB) CreateProperties(properties model.Properties) (*model.Properties, error)
- func (pg *DB) DeleteAllReadArticlesByUser(uid uint) (int64, error)
- func (pg *DB) DeleteArticle(id uint) error
- func (pg *DB) DeleteCategoriesByUser(uid uint, ids []uint) (int64, error)
- func (pg *DB) DeleteCategoryByUser(uid, id uint) error
- func (pg *DB) DeleteDevice(id uint) error
- func (pg *DB) DeleteDevicesByUser(uid uint, ids []uint) (int64, error)
- func (pg *DB) DeleteInactiveDevicesOlderThan(delay time.Duration) (int64, error)
- func (pg *DB) DeleteIncomingWebhookByUser(uid, id uint) error
- func (pg *DB) DeleteIncomingWebhooksByUser(uid uint, ids []uint) (int64, error)
- func (pg *DB) DeleteOutgoingWebhookByUser(uid, id uint) error
- func (pg *DB) DeleteOutgoingWebhooksByUser(uid uint, ids []uint) (int64, error)
- func (pg *DB) DeleteReadArticlesOlderThan(delay time.Duration) (int64, error)
- func (pg *DB) DeleteUser(user model.User) error
- func (pg *DB) GetArticleByID(id uint) (*model.Article, error)
- func (pg *DB) GetCategoriesByUser(uid uint) ([]model.Category, error)
- func (pg *DB) GetCategoryByID(id uint) (*model.Category, error)
- func (pg *DB) GetCategoryByUserAndTitle(uid uint, title string) (*model.Category, error)
- func (pg *DB) GetDeviceByID(id uint) (*model.Device, error)
- func (pg *DB) GetDeviceByUserAndKey(uid uint, key string) (*model.Device, error)
- func (pg *DB) GetDevicesByUser(uid uint) ([]model.Device, error)
- func (pg *DB) GetIncomingWebhookByID(id uint) (*model.IncomingWebhook, error)
- func (pg *DB) GetIncomingWebhookByToken(token string) (*model.IncomingWebhook, error)
- func (pg *DB) GetIncomingWebhookByUserAndAlias(uid uint, alias string) (*model.IncomingWebhook, error)
- func (pg *DB) GetIncomingWebhooksByUser(uid uint) ([]model.IncomingWebhook, error)
- func (pg *DB) GetOutgoingWebhookByID(id uint) (*model.OutgoingWebhook, error)
- func (pg *DB) GetOutgoingWebhookByUserAndAlias(uid uint, alias *string) (*model.OutgoingWebhook, error)
- func (pg *DB) GetOutgoingWebhooksByUser(uid uint) ([]model.OutgoingWebhook, error)
- func (pg *DB) GetPaginatedArticlesByUser(uid uint, req model.ArticlesPageRequest) (*model.ArticlesPageResponse, error)
- func (pg *DB) GetProperties() (*model.Properties, error)
- func (pg *DB) GetUserByID(id uint) (*model.User, error)
- func (pg *DB) GetUserByUsername(username string) (*model.User, error)
- func (pg *DB) ManageOutgoingWebhookSecrets(ctx context.Context, provider secret.EngineProvider, action secret.Action) (uint, error)
- func (pg *DB) MarkAllArticlesAsReadByUser(uid uint, status string, categoryID *uint) (int64, error)
- func (pg *DB) UpdateArticleForUser(uid uint, form model.ArticleUpdateForm) (*model.Article, error)
- func (pg *DB) UpdateCategoryForUser(uid uint, form model.CategoryUpdateForm) (*model.Category, error)
- func (pg *DB) UpdateIncomingWebhookForUser(uid uint, form model.IncomingWebhookUpdateForm) (*model.IncomingWebhook, error)
- func (pg *DB) UpdateOutgoingWebhookForUser(uid uint, form model.OutgoingWebhookUpdateForm) (*model.OutgoingWebhook, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is Database backed by PostgreSQL
func NewPostgreSQL ¶
NewPostgreSQL creates a Database backed by PostgreSQL
func (*DB) CountArticles ¶
CountArticles count articles
func (*DB) CountArticlesByUser ¶
CountArticlesByUser returns total nb of articles of an user from the DB
func (*DB) CountCategoriesByUser ¶
CountCategoriesByUser returns total nb of categories of an user from the DB
func (*DB) CountDevicesByUser ¶
CountDevicesByUser returns total nb of devices of an user from the DB
func (*DB) CountIncomingWebhooksByUser ¶
CountIncomingWebhooksByUser returns total nb of incoming webhooks of an user from the DB
func (*DB) CountOutgoingWebhooksByUser ¶
CountOutgoingWebhooksByUser returns total nb of outgoing webhooks of an user from the DB
func (*DB) CreateArticleForUser ¶
CreateArticleForUser creates an article into the DB
func (*DB) CreateCategoryForUser ¶
func (pg *DB) CreateCategoryForUser(uid uint, form model.CategoryCreateForm) (*model.Category, error)
CreateCategoryForUser create a category for an user
func (*DB) CreateDevice ¶
CreateDevice create a device
func (*DB) CreateIncomingWebhookForUser ¶
func (pg *DB) CreateIncomingWebhookForUser(uid uint, form model.IncomingWebhookCreateForm) (*model.IncomingWebhook, error)
CreateIncomingWebhookForUser creates an incoming webhook for a user
func (*DB) CreateOrUpdateUser ¶
CreateOrUpdateUser creates or updates a user into the DB
func (*DB) CreateOutgoingWebhookForUser ¶
func (pg *DB) CreateOutgoingWebhookForUser(uid uint, form model.OutgoingWebhookCreateForm) (*model.OutgoingWebhook, error)
CreateOutgoingWebhookForUser creates an outgoing webhook into the DB
func (*DB) CreateProperties ¶
func (pg *DB) CreateProperties(properties model.Properties) (*model.Properties, error)
CreateProperties update properties (create a new revision)
func (*DB) DeleteAllReadArticlesByUser ¶
DeleteAllReadArticlesByUser remove all read articles from the DB
func (*DB) DeleteArticle ¶
DeleteArticle remove an article from the DB
func (*DB) DeleteCategoriesByUser ¶
DeleteCategoriesByUser removes categories from the DB
func (*DB) DeleteCategoryByUser ¶
DeleteCategoryByUser removes an category from the DB
func (*DB) DeleteDevice ¶
DeleteDevice removes an device from the DB
func (*DB) DeleteDevicesByUser ¶
DeleteDevicesByUser removes devices from the DB
func (*DB) DeleteInactiveDevicesOlderThan ¶
DeleteInactiveDevicesOlderThan remove inactive devices from the DB
func (*DB) DeleteIncomingWebhookByUser ¶
DeleteIncomingWebhookByUser removes an inboundService from the DB
func (*DB) DeleteIncomingWebhooksByUser ¶
DeleteIncomingWebhooksByUser removes incoming webhooks from the DB
func (*DB) DeleteOutgoingWebhookByUser ¶
DeleteOutgoingWebhookByUser removes an outgoing webhook from the DB
func (*DB) DeleteOutgoingWebhooksByUser ¶
DeleteOutgoingWebhooksByUser removes outgoing webhooks from the DB
func (*DB) DeleteReadArticlesOlderThan ¶
DeleteReadArticlesOlderThan remove old articles from the DB
func (*DB) DeleteUser ¶
DeleteUser removes an user from the DB
func (*DB) GetArticleByID ¶
GetArticleByID returns an article by its ID from DB
func (*DB) GetCategoriesByUser ¶
GetCategoriesByUser returns categories of an user from DB
func (*DB) GetCategoryByID ¶
GetCategoryByID returns a category from the DB
func (*DB) GetCategoryByUserAndTitle ¶
GetCategoryByUserAndTitle returns a category of an user form the DB
func (*DB) GetDeviceByID ¶
GetDeviceByID get a device from the DB
func (*DB) GetDeviceByUserAndKey ¶
GetDeviceByUserAndKey get an device from the DB Only exposed for testing purpose!
func (*DB) GetDevicesByUser ¶
GetDevicesByUser returns devices of an user from DB
func (*DB) GetIncomingWebhookByID ¶
func (pg *DB) GetIncomingWebhookByID(id uint) (*model.IncomingWebhook, error)
GetIncomingWebhookByID get an incoming webhook from the DB
func (*DB) GetIncomingWebhookByToken ¶
func (pg *DB) GetIncomingWebhookByToken(token string) (*model.IncomingWebhook, error)
GetIncomingWebhookByToken find an incoming webhook by token form the DB (last usage is updated!)
func (*DB) GetIncomingWebhookByUserAndAlias ¶
func (pg *DB) GetIncomingWebhookByUserAndAlias(uid uint, alias string) (*model.IncomingWebhook, error)
GetIncomingWebhookByUserAndAlias returns incoming webhook of an user by its alias
func (*DB) GetIncomingWebhooksByUser ¶
func (pg *DB) GetIncomingWebhooksByUser(uid uint) ([]model.IncomingWebhook, error)
GetIncomingWebhooksByUser returns incoming webhooks of an user from DB
func (*DB) GetOutgoingWebhookByID ¶
func (pg *DB) GetOutgoingWebhookByID(id uint) (*model.OutgoingWebhook, error)
GetOutgoingWebhookByID get an outgoing webhook from the DB
func (*DB) GetOutgoingWebhookByUserAndAlias ¶
func (pg *DB) GetOutgoingWebhookByUserAndAlias(uid uint, alias *string) (*model.OutgoingWebhook, error)
GetOutgoingWebhookByUserAndAlias get an outgoing webhook from the DB. Default outgoing webhook is returned if alias is nil.
func (*DB) GetOutgoingWebhooksByUser ¶
func (pg *DB) GetOutgoingWebhooksByUser(uid uint) ([]model.OutgoingWebhook, error)
GetOutgoingWebhooksByUser returns outgoing webhooks of an user from DB
func (*DB) GetPaginatedArticlesByUser ¶
func (pg *DB) GetPaginatedArticlesByUser(uid uint, req model.ArticlesPageRequest) (*model.ArticlesPageResponse, error)
GetPaginatedArticlesByUser returns a paginated list of user's articles from the DB
func (*DB) GetProperties ¶
func (pg *DB) GetProperties() (*model.Properties, error)
GetProperties get last revision of properties from the DB
func (*DB) GetUserByID ¶
GetUserByID returns a user by its ID from DB
func (*DB) GetUserByUsername ¶
GetUserByUsername returns user by its username from DB
func (*DB) ManageOutgoingWebhookSecrets ¶
func (pg *DB) ManageOutgoingWebhookSecrets(ctx context.Context, provider secret.EngineProvider, action secret.Action) (uint, error)
ManageOutgoingWebhookSecrets manage protection of outgoing webhook secrets
func (*DB) MarkAllArticlesAsReadByUser ¶
MarkAllArticlesAsReadByUser set status to read for all user's articles of a specific status and category
func (*DB) UpdateArticleForUser ¶
UpdateArticleForUser updates an article into the DB
func (*DB) UpdateCategoryForUser ¶
func (pg *DB) UpdateCategoryForUser(uid uint, form model.CategoryUpdateForm) (*model.Category, error)
UpdateCategoryForUser update a category for an user
func (*DB) UpdateIncomingWebhookForUser ¶
func (pg *DB) UpdateIncomingWebhookForUser(uid uint, form model.IncomingWebhookUpdateForm) (*model.IncomingWebhook, error)
UpdateIncomingWebhookForUser updates an incoming webhook for a user
func (*DB) UpdateOutgoingWebhookForUser ¶
func (pg *DB) UpdateOutgoingWebhookForUser(uid uint, form model.OutgoingWebhookUpdateForm) (*model.OutgoingWebhook, error)
UpdateOutgoingWebhookForUser update an outgoing webhook of the DB