package repository import ( "backend/pkg/permission/domain/entity" "backend/pkg/permission/domain/permission" "context" mongodriver "go.mongodb.org/mongo-driver/v2/mongo" ) // RoleRepository 角色 Repository 介面 type RoleRepository interface { // Create 建立角色 Create(ctx context.Context, role *entity.Role) error // Update 更新角色 Update(ctx context.Context, role *entity.Role) error // Delete 刪除角色 (軟刪除) Delete(ctx context.Context, uid string) error // Get 取得單一角色 (by ID) Get(ctx context.Context, id int64) (*entity.Role, error) // GetByUID 取得單一角色 (by UID) GetByUID(ctx context.Context, uid string) (*entity.Role, error) // GetByUIDs 批量取得角色 (by UIDs) GetByUIDs(ctx context.Context, uids []string) ([]*entity.Role, error) // List 列出所有角色 List(ctx context.Context, filter RoleFilter) ([]*entity.Role, error) // Page 分頁查詢角色 Page(ctx context.Context, filter RoleFilter, page, size int) ([]*entity.Role, int64, error) // Exists 檢查角色是否存在 Exists(ctx context.Context, uid string) (bool, error) // NextID 取得下一個角色 ID(用於生成 UID) NextID(ctx context.Context) (int64, error) Index20251009002UP(ctx context.Context) (*mongodriver.Cursor, error) } // RoleFilter 角色查詢過濾條件 type RoleFilter struct { ClientID int UID string Name string Status *permission.RecordState Permissions []string }