Documentation
¶
Index ¶
- Variables
- type CreateParams
- type DeleteParams
- type Repository
- type RepositoryWithLogging
- func (_d RepositoryWithLogging) Create(ctx context.Context, tx postgres.DBTX, params *CreateParams) (rp1 *Role, err error)
- func (_d RepositoryWithLogging) Delete(ctx context.Context, tx postgres.DBTX, params *DeleteParams) (err error)
- func (_d RepositoryWithLogging) EnsureDefault(ctx context.Context, tx postgres.DBTX, params *CreateParams) (rp1 *Role, err error)
- func (_d RepositoryWithLogging) FindBySlug(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, roleSlug slug.Slug) (rp1 *Role, err error)
- func (_d RepositoryWithLogging) GetUserPermissionsInOrg(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, userSlug slug.Slug) (upa1 []*UserPermission, err error)
- func (_d RepositoryWithLogging) ListByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, ...) (rpa1 []*Role, err error)
- func (_d RepositoryWithLogging) Restore(ctx context.Context, tx postgres.DBTX, params *RestoreParams) (err error)
- func (_d RepositoryWithLogging) Update(ctx context.Context, tx postgres.DBTX, params *UpdateParams) (err error)
- type RestoreParams
- type Role
- type UpdateParams
- type UserPermission
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = xerror.NotFound(xerror.Role) ErrSlugAlreadyExists = xerror.AlreadyExists(xerror.Role) ErrCannotDeleteSystemRole = xerror.CannotDeleteDefault(xerror.Role) ErrUserNotMember = xerror.NotFound(xerror.UserMember) )
Functions ¶
This section is empty.
Types ¶
type CreateParams ¶
type Repository ¶
type Repository interface {
Create(ctx context.Context, tx postgres.DBTX, params *CreateParams) (*Role, error)
EnsureDefault(ctx context.Context, tx postgres.DBTX, params *CreateParams) (*Role, error)
FindBySlug(ctx context.Context, tx postgres.DBTX, orgSlug, roleSlug slug.Slug) (*Role, error)
ListByOrganization(
ctx context.Context,
tx postgres.DBTX,
orgSlug slug.Slug,
req model.ListRequest,
includeDeleted bool,
onlyDeleted bool,
) ([]*Role, error)
GetUserPermissionsInOrg(
ctx context.Context,
tx postgres.DBTX,
orgSlug, userSlug slug.Slug,
) ([]*UserPermission, error)
Update(ctx context.Context, tx postgres.DBTX, params *UpdateParams) error
Delete(ctx context.Context, tx postgres.DBTX, params *DeleteParams) error
Restore(ctx context.Context, tx postgres.DBTX, params *RestoreParams) error
}
func NewRepository ¶
func NewRepository() Repository
func NewRepositoryWithLogging ¶
func NewRepositoryWithLogging(base Repository, logger *slog.Logger) Repository
NewRepositoryWithLogging wraps base with method completion logging.
type RepositoryWithLogging ¶
type RepositoryWithLogging struct {
// contains filtered or unexported fields
}
RepositoryWithLogging implements Repository with method completion logging.
func (RepositoryWithLogging) Create ¶
func (_d RepositoryWithLogging) Create(ctx context.Context, tx postgres.DBTX, params *CreateParams) (rp1 *Role, err error)
Create implements Repository.
func (RepositoryWithLogging) Delete ¶
func (_d RepositoryWithLogging) Delete(ctx context.Context, tx postgres.DBTX, params *DeleteParams) (err error)
Delete implements Repository.
func (RepositoryWithLogging) EnsureDefault ¶
func (_d RepositoryWithLogging) EnsureDefault(ctx context.Context, tx postgres.DBTX, params *CreateParams) (rp1 *Role, err error)
EnsureDefault implements Repository.
func (RepositoryWithLogging) FindBySlug ¶
func (_d RepositoryWithLogging) FindBySlug(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, roleSlug slug.Slug) (rp1 *Role, err error)
FindBySlug implements Repository.
func (RepositoryWithLogging) GetUserPermissionsInOrg ¶
func (_d RepositoryWithLogging) GetUserPermissionsInOrg(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, userSlug slug.Slug) (upa1 []*UserPermission, err error)
GetUserPermissionsInOrg implements Repository.
func (RepositoryWithLogging) ListByOrganization ¶
func (_d RepositoryWithLogging) ListByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, req model.ListRequest, includeDeleted bool, onlyDeleted bool) (rpa1 []*Role, err error)
ListByOrganization implements Repository.
func (RepositoryWithLogging) Restore ¶
func (_d RepositoryWithLogging) Restore(ctx context.Context, tx postgres.DBTX, params *RestoreParams) (err error)
Restore implements Repository.
func (RepositoryWithLogging) Update ¶
func (_d RepositoryWithLogging) Update(ctx context.Context, tx postgres.DBTX, params *UpdateParams) (err error)
Update implements Repository.
type UserPermission ¶
Click to show internal directories.
Click to hide internal directories.