27 lines
973 B
Go
27 lines
973 B
Go
|
|
package repository
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
|
||
|
|
"gateway/internal/model/permission/domain/entity"
|
||
|
|
)
|
||
|
|
|
||
|
|
// RoleUpdate carries optional patches for RoleRepository.Update. Pointer
|
||
|
|
// fields preserve "absent" semantics so the usecase can run a partial
|
||
|
|
// update without overwriting unchanged fields.
|
||
|
|
type RoleUpdate struct {
|
||
|
|
DisplayName *string
|
||
|
|
Status *string
|
||
|
|
}
|
||
|
|
|
||
|
|
// RoleRepository persists tenant-scoped Role definitions.
|
||
|
|
type RoleRepository interface {
|
||
|
|
Insert(ctx context.Context, role *entity.Role) error
|
||
|
|
GetByID(ctx context.Context, tenantID, id string) (*entity.Role, error)
|
||
|
|
GetByKey(ctx context.Context, tenantID, key string) (*entity.Role, error)
|
||
|
|
ListByTenant(ctx context.Context, tenantID string) ([]*entity.Role, error)
|
||
|
|
ListByTenantAndIDs(ctx context.Context, tenantID string, ids []string) ([]*entity.Role, error)
|
||
|
|
Update(ctx context.Context, tenantID, id string, update *RoleUpdate) (*entity.Role, error)
|
||
|
|
Delete(ctx context.Context, tenantID, id string) error
|
||
|
|
}
|