package repository import ( "context" "permission/reborn/domain/entity" ) // UserRoleRepository 使用者角色 Repository 介面 type UserRoleRepository interface { // Create 建立使用者角色 Create(ctx context.Context, userRole *entity.UserRole) error // Update 更新使用者角色 Update(ctx context.Context, uid, roleID string) (*entity.UserRole, error) // Delete 刪除使用者角色 Delete(ctx context.Context, uid string) error // Get 取得使用者角色 Get(ctx context.Context, uid string) (*entity.UserRole, error) // GetByRoleID 根據角色 ID 取得所有使用者 GetByRoleID(ctx context.Context, roleID string) ([]*entity.UserRole, error) // List 列出所有使用者角色 List(ctx context.Context, filter UserRoleFilter) ([]*entity.UserRole, error) // CountByRoleID 統計每個角色的使用者數量 CountByRoleID(ctx context.Context, roleIDs []string) (map[string]int, error) // Exists 檢查使用者是否已有角色 Exists(ctx context.Context, uid string) (bool, error) } // UserRoleFilter 使用者角色查詢過濾條件 type UserRoleFilter struct { Brand string RoleID string Status *entity.Status }