Documentation
¶
Index ¶
- Variables
- type AdminPermissionRepository
- type AgentRepository
- type NamespaceRepository
- type PageDraftRepository
- type PageRepository
- type ProjectRepository
- type RedirectDraftRepository
- type RedirectRepository
- type Repositories
- type ResourcePermissionRepository
- type RoleRepository
- type TokenRepository
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AdminPermissionRepository ¶
type AdminPermissionRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
Create(ctx context.Context, perm *model.AdminPermission) error
Update(ctx context.Context, perm *model.AdminPermission) error
Delete(ctx context.Context, id int64) error
FindByID(ctx context.Context, id int64) (*model.AdminPermission, error)
FindByRoleID(ctx context.Context, roleID int64) ([]model.AdminPermission, error)
FindByRoleIDs(ctx context.Context, roleIDs []int64) ([]model.AdminPermission, error)
FindBySection(ctx context.Context, section model.SectionType) ([]model.AdminPermission, error)
DeleteByRoleID(ctx context.Context, roleID int64) error
}
func NewAdminPermissionRepository ¶
func NewAdminPermissionRepository(db *gorm.DB) AdminPermissionRepository
type AgentRepository ¶
type AgentRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
Upsert(ctx context.Context, agent *model.Agent) error
FindByName(ctx context.Context, namespaceCode, projectCode, name string) (*model.Agent, error)
FindByProject(ctx context.Context, namespaceCode, projectCode string) ([]model.Agent, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.Agent, int64, error)
CountByProjectAndStatus(ctx context.Context, namespaceCode, projectCode string, status commonTypes.AgentStatus, lastHitAfter time.Time) (int64, error)
UpdateLastHit(ctx context.Context, namespaceCode, projectCode, name string) error
Delete(ctx context.Context, namespaceCode, projectCode, name string) error
}
func NewAgentRepository ¶
func NewAgentRepository(db *gorm.DB) AgentRepository
type NamespaceRepository ¶
type NamespaceRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
Create(ctx context.Context, namespace *model.Namespace) error
Update(ctx context.Context, namespace *model.Namespace) error
DeleteByCode(ctx context.Context, code string) error
FindByCode(ctx context.Context, code string) (*model.Namespace, error)
FindAll(ctx context.Context) ([]model.Namespace, error)
Search(ctx context.Context, query *gorm.DB) ([]model.Namespace, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.Namespace, int64, error)
}
func NewNamespaceRepository ¶
func NewNamespaceRepository(db *gorm.DB) NamespaceRepository
type PageDraftRepository ¶
type PageDraftRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
FindByID(ctx context.Context, id int64) (*model.PageDraft, error)
FindByIDWithProject(ctx context.Context, namespaceCode, projectCode string, id int64) (*model.PageDraft, error)
FindByProject(ctx context.Context, namespaceCode, projectCode string) ([]model.PageDraft, error)
Create(ctx context.Context, draft *model.PageDraft) error
Update(ctx context.Context, draft *model.PageDraft) error
Delete(ctx context.Context, id int64) error
Search(ctx context.Context, query *gorm.DB) ([]model.PageDraft, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.PageDraft, int64, error)
CheckPathAvailability(ctx context.Context, namespaceCode, projectCode, path string, excludePageID, excludeDraftID *int64) (bool, error)
}
func NewPageDraftRepository ¶
func NewPageDraftRepository(db *gorm.DB) PageDraftRepository
type PageRepository ¶
type PageRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
FindByID(ctx context.Context, namespaceCode, projectCode string, pageID int64) (*model.Page, error)
FindByProject(ctx context.Context, namespaceCode, projectCode string) ([]model.Page, error)
FindByProjectPublished(ctx context.Context, namespaceCode, projectCode string, limit, offset int) ([]model.Page, int64, error)
Search(ctx context.Context, query *gorm.DB) ([]model.Page, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.Page, int64, error)
GetTotalContentSize(ctx context.Context, namespaceCode, projectCode string) (int64, error)
}
func NewPageRepository ¶
func NewPageRepository(db *gorm.DB) PageRepository
type ProjectRepository ¶
type ProjectRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
Create(ctx context.Context, project *model.Project) error
Update(ctx context.Context, project *model.Project) error
Delete(ctx context.Context, namespaceCode, projectCode string) error
DeleteByNamespaceCode(ctx context.Context, namespaceCode string) error
FindByCode(ctx context.Context, namespaceCode, projectCode string) (*model.Project, error)
FindByCodeWithNamespace(ctx context.Context, namespaceCode, projectCode string) (*model.Project, error)
FindAll(ctx context.Context) ([]model.Project, error)
FindByNamespace(ctx context.Context, namespaceCode string) ([]model.Project, error)
Search(ctx context.Context, query *gorm.DB) ([]model.Project, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.Project, int64, error)
CountRedirects(ctx context.Context, namespaceCode, projectCode string) (int64, error)
CountRedirectDrafts(ctx context.Context, namespaceCode, projectCode string) (int64, error)
CountPages(ctx context.Context, namespaceCode, projectCode string) (int64, error)
CountPageDrafts(ctx context.Context, namespaceCode, projectCode string) (int64, error)
}
func NewProjectRepository ¶
func NewProjectRepository(db *gorm.DB) ProjectRepository
type RedirectDraftRepository ¶
type RedirectDraftRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
FindByID(ctx context.Context, id int64) (*model.RedirectDraft, error)
FindByIDWithProject(ctx context.Context, namespaceCode, projectCode string, id int64) (*model.RedirectDraft, error)
FindByProject(ctx context.Context, namespaceCode, projectCode string) ([]model.RedirectDraft, error)
Create(ctx context.Context, draft *model.RedirectDraft) error
Update(ctx context.Context, draft *model.RedirectDraft) error
Delete(ctx context.Context, id int64) error
Search(ctx context.Context, query *gorm.DB) ([]model.RedirectDraft, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.RedirectDraft, int64, error)
CheckSourceAvailability(ctx context.Context, namespaceCode, projectCode, source string, excludeRedirectID, excludeDraftID *int64) (bool, error)
}
func NewRedirectDraftRepository ¶
func NewRedirectDraftRepository(db *gorm.DB) RedirectDraftRepository
type RedirectRepository ¶
type RedirectRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
FindByID(ctx context.Context, namespaceCode, projectCode string, redirectID int64) (*model.Redirect, error)
FindByProject(ctx context.Context, namespaceCode, projectCode string) ([]model.Redirect, error)
FindByProjectPublished(ctx context.Context, namespaceCode, projectCode string, limit, offset int) ([]model.Redirect, int64, error)
Search(ctx context.Context, query *gorm.DB) ([]model.Redirect, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.Redirect, int64, error)
}
func NewRedirectRepository ¶
func NewRedirectRepository(db *gorm.DB) RedirectRepository
type Repositories ¶
type Repositories struct {
Namespace NamespaceRepository
Project ProjectRepository
User UserRepository
Role RoleRepository
Redirect RedirectRepository
RedirectDraft RedirectDraftRepository
Page PageRepository
PageDraft PageDraftRepository
Agent AgentRepository
Token TokenRepository
}
func NewRepositories ¶
func NewRepositories(db *gorm.DB) *Repositories
type ResourcePermissionRepository ¶
type ResourcePermissionRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
Create(ctx context.Context, perm *model.ResourcePermission) error
Update(ctx context.Context, perm *model.ResourcePermission) error
Delete(ctx context.Context, id int64) error
FindByID(ctx context.Context, id int64) (*model.ResourcePermission, error)
FindByRoleID(ctx context.Context, roleID int64) ([]model.ResourcePermission, error)
FindByRoleIDs(ctx context.Context, roleIDs []int64) ([]model.ResourcePermission, error)
FindByNamespace(ctx context.Context, namespace string) ([]model.ResourcePermission, error)
FindByNamespaceAndProject(ctx context.Context, namespace, project string) ([]model.ResourcePermission, error)
DeleteByRoleID(ctx context.Context, roleID int64) error
}
func NewResourcePermissionRepository ¶
func NewResourcePermissionRepository(db *gorm.DB) ResourcePermissionRepository
type RoleRepository ¶
type RoleRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
Create(ctx context.Context, role *model.Role) error
Update(ctx context.Context, role *model.Role) error
Delete(ctx context.Context, id int64) error
FindByID(ctx context.Context, id int64) (*model.Role, error)
FindByCode(ctx context.Context, code string) (*model.Role, error)
FindByCodeAndType(ctx context.Context, code string, roleType model.RoleType) (*model.Role, error)
FindAll(ctx context.Context) ([]model.Role, error)
FindAllByType(ctx context.Context, roleType model.RoleType) ([]model.Role, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.Role, int64, error)
// User-Role associations
AddUserToRole(ctx context.Context, userID, roleID int64) error
RemoveUserFromRole(ctx context.Context, userID, roleID int64) error
GetUserRoles(ctx context.Context, userID int64) ([]model.Role, error)
GetUserRolesByType(ctx context.Context, userID int64, roleType model.RoleType) ([]model.Role, error)
GetRoleUsers(ctx context.Context, roleID int64) ([]model.User, error)
GetRoleUsersPaginate(ctx context.Context, roleID int64, search string, limit, offset int) ([]model.User, int64, error)
GetUsersNotInRole(ctx context.Context, roleID int64, search string, limit int) ([]model.User, error)
HasUserRole(ctx context.Context, userID, roleID int64) (bool, error)
}
func NewRoleRepository ¶
func NewRoleRepository(db *gorm.DB) RoleRepository
type TokenRepository ¶
type TokenRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
Create(ctx context.Context, token *model.Token) error
Delete(ctx context.Context, id int64) error
FindByID(ctx context.Context, id int64) (*model.Token, error)
FindByName(ctx context.Context, name string) (*model.Token, error)
FindByHash(ctx context.Context, hash string) (*model.Token, error)
FindAll(ctx context.Context) ([]model.Token, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.Token, int64, error)
}
func NewTokenRepository ¶
func NewTokenRepository(db *gorm.DB) TokenRepository
type UserRepository ¶
type UserRepository interface {
GetTx(ctx context.Context) *gorm.DB
GetQuery(ctx context.Context) *gorm.DB
Create(ctx context.Context, user *model.User) error
Update(ctx context.Context, user *model.User) error
Delete(ctx context.Context, id int64) error
FindByID(ctx context.Context, id int64) (*model.User, error)
FindByUsername(ctx context.Context, username string) (*model.User, error)
FindAll(ctx context.Context) ([]model.User, error)
Search(ctx context.Context, query *gorm.DB) ([]model.User, error)
SearchPaginate(ctx context.Context, query *gorm.DB, limit, offset int) ([]model.User, int64, error)
UpdatePassword(ctx context.Context, id int64, hashedPassword string) error
UpdateStatus(ctx context.Context, id int64, active bool) error
UpdateRefreshTokenHash(ctx context.Context, id int64, hash string) error
}
func NewUserRepository ¶
func NewUserRepository(db *gorm.DB) UserRepository
Click to show internal directories.
Click to hide internal directories.