Documentation
¶
Index ¶
- type ApprovalService
- func (s *ApprovalService) ApplyToJoin(req *dto.NamespaceJoinApprovalReqBody) error
- func (s *ApprovalService) ApproveRequest(req *dto.SwitchApprovalReqBody) error
- func (s *ApprovalService) GetAllRequests(req *dto.MyRequestReqBody) map[string]interface{}
- func (s *ApprovalService) GetRequestsByRequester(req *dto.MyRequestReqBody) map[string]interface{}
- type AuthService
- func (s *AuthService) Login(ctx *gin.Context, username string, password string, autoLogin bool) (string, error)
- func (s *AuthService) RefreshToken(ctx *gin.Context, refreshToken *dto.RefreshToken) (string, error)
- func (s *AuthService) Register(ctx *gin.Context, req *dto.RegisterReq) (*dto.RegisterRes, error)
- type EnvironmentService
- func (s *EnvironmentService) CreateUpdateEnvironment(ctx *gin.Context, req *dto.EnvCreateUpdateReq) error
- func (s *EnvironmentService) EnvPublish(ctx *gin.Context, req *dto.EnvPublishReq) error
- func (s *EnvironmentService) GetEnvironmentsByNamespace(namespaceTag string) ([]*admin_model.Environment, error)
- func (s *EnvironmentService) GetEnvs(ctx *gin.Context, req *dto.EnvListReq) map[string]interface{}
- type NamespaceMembersService
- type NamespaceService
- func (s *NamespaceService) AddNamespaceMember(tx *gorm.DB, req *admin_model.NamespaceMembers) error
- func (s *NamespaceService) CreateUpdateNamespace(ctx *gin.Context, req *dto.CreateUpdateNamespaceReq) (*admin_model.Namespace, error)
- func (s *NamespaceService) GetNamespaces(ctx *gin.Context, namespaceListReq *dto.NamespaceListReq) map[string]interface{}
- func (s *NamespaceService) GetNamespacesLike(ctx *gin.Context, namespaceListLikeReq *dto.NamespaceListLikeReq) []*dto.NamespaceListLikeResp
- type PermissionService
- func (s *PermissionService) AssignRoles(req *dto.AssignRolesReq) error
- func (s *PermissionService) Permissions(namespaceTag string) ([]*admin_model.Permission, error)
- func (s *PermissionService) RolesPermission(req *dto.RoleListReq) map[string]interface{}
- func (s *PermissionService) UpsertPermission(ctx context.Context, req *dto.UpsertPermissionReq) error
- func (s *PermissionService) UpsertRole(ctx context.Context, req *dto.UpsertRoleReq) error
- type RBACService
- type SwitchDetailsResponse
- type SwitchService
- func (s *SwitchService) CreateSwitch(ctx *gin.Context, req *dto.CreateUpdateSwitchReq) (*model.SwitchModel, error)
- func (s *SwitchService) CreateUpdateSwitchFactor(ctx *gin.Context, req *dto.CreateSwitchFactorReq) (*admin_model.SwitchFactor, error)
- func (s *SwitchService) ExecutePublishRequest(snapshot *admin_model.SwitchSnapshot, config *admin_model.SwitchConfig, ...) error
- func (s *SwitchService) GetSwitchDetails(switchID uint) (*SwitchDetailsResponse, error)
- func (s *SwitchService) PushSwitchChange(ctx *gin.Context, req *dto.SubmitSwitchPushReq) (string, error)
- func (s *SwitchService) SwitchFactorLike(ctx *gin.Context, req *dto.SwitchFactorLikeReq) []*admin_model.SwitchFactor
- func (s *SwitchService) SwitchFactorList(ctx *gin.Context, req *dto.SwitchFactorListReq) map[string]interface{}
- func (s *SwitchService) SwitchList(ctx *gin.Context, req *dto.SwitchListReq) map[string]interface{}
- type UserService
- func (s *UserService) GetAllUserLike(ctx context.Context, req *dto.AllUserLikeReq) ([]*admin_model.User, error)
- func (s *UserService) GetUserInfo(userID uint) (*admin_model.User, error)
- func (s *UserService) GetUsers(ctx context.Context, req *dto.UserListReq) map[string]interface{}
- func (s *UserService) GetUsersPermissions(ctx context.Context, req *dto.UserPermissionsListReq) []*dto.UserPermissionsListResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApprovalService ¶
type ApprovalService struct {
// contains filtered or unexported fields
}
ApprovalService 提供了与审批相关的业务逻辑
func NewApprovalService ¶
func NewApprovalService() *ApprovalService
func (*ApprovalService) ApplyToJoin ¶
func (s *ApprovalService) ApplyToJoin(req *dto.NamespaceJoinApprovalReqBody) error
ApplyToJoin 加入空间
func (*ApprovalService) ApproveRequest ¶
func (s *ApprovalService) ApproveRequest(req *dto.SwitchApprovalReqBody) error
ApproveRequest 批准一个审批请求
func (*ApprovalService) GetAllRequests ¶
func (s *ApprovalService) GetAllRequests(req *dto.MyRequestReqBody) map[string]interface{}
GetAllRequests 获取所有单子(不区分发起人跟受邀人)
func (*ApprovalService) GetRequestsByRequester ¶
func (s *ApprovalService) GetRequestsByRequester(req *dto.MyRequestReqBody) map[string]interface{}
GetRequestsByRequester 获取所有单子(区分发起人跟受邀人)
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
AuthService 提供认证相关的服务。
func NewAuthService ¶
func NewAuthService(cfg *config.Config) *AuthService
func (*AuthService) Login ¶
func (s *AuthService) Login(ctx *gin.Context, username string, password string, autoLogin bool) (string, error)
Login 验证凭据,如果有效则返回 JWT 令牌
func (*AuthService) RefreshToken ¶
func (s *AuthService) RefreshToken(ctx *gin.Context, refreshToken *dto.RefreshToken) (string, error)
RefreshToken 刷新令牌
func (*AuthService) Register ¶
func (s *AuthService) Register(ctx *gin.Context, req *dto.RegisterReq) (*dto.RegisterRes, error)
Register 创建新用户
type EnvironmentService ¶
type EnvironmentService struct {
// contains filtered or unexported fields
}
EnvironmentService 提供了与环境相关的业务逻辑
func NewEnvironmentService ¶
func NewEnvironmentService() *EnvironmentService
func (*EnvironmentService) CreateUpdateEnvironment ¶
func (s *EnvironmentService) CreateUpdateEnvironment(ctx *gin.Context, req *dto.EnvCreateUpdateReq) error
CreateUpdateEnvironment 创建/修改
func (*EnvironmentService) EnvPublish ¶
func (s *EnvironmentService) EnvPublish(ctx *gin.Context, req *dto.EnvPublishReq) error
func (*EnvironmentService) GetEnvironmentsByNamespace ¶
func (s *EnvironmentService) GetEnvironmentsByNamespace(namespaceTag string) ([]*admin_model.Environment, error)
GetEnvironmentsByNamespace 获取指定命名空间下的所有环境
func (*EnvironmentService) GetEnvs ¶
func (s *EnvironmentService) GetEnvs(ctx *gin.Context, req *dto.EnvListReq) map[string]interface{}
type NamespaceMembersService ¶
type NamespaceMembersService struct {
// contains filtered or unexported fields
}
NamespaceMembersService 命名空间跟用户的关联业务
func NewNamespaceMembersService ¶
func NewNamespaceMembersService() *NamespaceMembersService
func (*NamespaceMembersService) FindApprovePermissionsByNamespaceTag ¶
func (n *NamespaceMembersService) FindApprovePermissionsByNamespaceTag(namespaceTag string) ([]uint, error)
type NamespaceService ¶
type NamespaceService struct {
// contains filtered or unexported fields
}
NamespaceService 提供了与命名空间相关的业务逻辑
func NewNamespaceService ¶
func NewNamespaceService() *NamespaceService
func (*NamespaceService) AddNamespaceMember ¶
func (s *NamespaceService) AddNamespaceMember(tx *gorm.DB, req *admin_model.NamespaceMembers) error
AddNamespaceMember 给空间下新增用户并分配角色
func (*NamespaceService) CreateUpdateNamespace ¶
func (s *NamespaceService) CreateUpdateNamespace(ctx *gin.Context, req *dto.CreateUpdateNamespaceReq) (*admin_model.Namespace, error)
CreateUpdateNamespace 创建一个命名空间/修改
func (*NamespaceService) GetNamespaces ¶
func (s *NamespaceService) GetNamespaces(ctx *gin.Context, namespaceListReq *dto.NamespaceListReq) map[string]interface{}
GetNamespaces 获取所有命名空间
func (*NamespaceService) GetNamespacesLike ¶
func (s *NamespaceService) GetNamespacesLike(ctx *gin.Context, namespaceListLikeReq *dto.NamespaceListLikeReq) []*dto.NamespaceListLikeResp
GetNamespacesLike 获取所有命名空间
type PermissionService ¶
type PermissionService struct {
// contains filtered or unexported fields
}
PermissionService 权限相关
func NewPermissionService ¶
func NewPermissionService() *PermissionService
func (*PermissionService) AssignRoles ¶
func (s *PermissionService) AssignRoles(req *dto.AssignRolesReq) error
AssignRoles 为用户分配角色
func (*PermissionService) Permissions ¶
func (s *PermissionService) Permissions(namespaceTag string) ([]*admin_model.Permission, error)
Permissions 获取指定命名空间下的所有权限
func (*PermissionService) RolesPermission ¶
func (s *PermissionService) RolesPermission(req *dto.RoleListReq) map[string]interface{}
RolesPermission 获取指定命名空间下的所有角色权限
func (*PermissionService) UpsertPermission ¶
func (s *PermissionService) UpsertPermission(ctx context.Context, req *dto.UpsertPermissionReq) error
UpsertPermission 新增/修改权限
func (*PermissionService) UpsertRole ¶
func (s *PermissionService) UpsertRole(ctx context.Context, req *dto.UpsertRoleReq) error
UpsertRole 新增/修改角色
type RBACService ¶
type RBACService struct {
// contains filtered or unexported fields
}
func NewRBACService ¶
func NewRBACService() *RBACService
func (*RBACService) CheckPermission ¶
func (s *RBACService) CheckPermission(roleID uint, requiredPermission string) (bool, error)
CheckPermission 检查roleID下是否可以进行requiredPermission
type SwitchDetailsResponse ¶
type SwitchDetailsResponse struct {
SwitchModel *model.SwitchModel `json:"factor"`
Configs []*admin_model.SwitchConfig `json:"configs"`
Approvals []*admin_model.SwitchApproval `json:"approvals"`
}
SwitchDetailsResponse 定义了开关详情的响应体
type SwitchService ¶
type SwitchService struct {
// contains filtered or unexported fields
}
SwitchService 提供了与开关相关的业务逻辑
func NewSwitchService ¶
func NewSwitchService() *SwitchService
NewSwitchService 创建一个新的 SwitchService
func (*SwitchService) CreateSwitch ¶
func (s *SwitchService) CreateSwitch(ctx *gin.Context, req *dto.CreateUpdateSwitchReq) (*model.SwitchModel, error)
CreateSwitch 创建一个新开关,并为该开关所属命名空间下的环境创建配置
func (*SwitchService) CreateUpdateSwitchFactor ¶
func (s *SwitchService) CreateUpdateSwitchFactor(ctx *gin.Context, req *dto.CreateSwitchFactorReq) (*admin_model.SwitchFactor, error)
CreateUpdateSwitchFactor 因子信息的新建和更新
func (*SwitchService) ExecutePublishRequest ¶
func (s *SwitchService) ExecutePublishRequest(snapshot *admin_model.SwitchSnapshot, config *admin_model.SwitchConfig, switchInstance *model.SwitchModel) error
func (*SwitchService) GetSwitchDetails ¶
func (s *SwitchService) GetSwitchDetails(switchID uint) (*SwitchDetailsResponse, error)
GetSwitchDetails 获取开关的详细信息,包括其在所有环境下的配置
func (*SwitchService) PushSwitchChange ¶
func (s *SwitchService) PushSwitchChange(ctx *gin.Context, req *dto.SubmitSwitchPushReq) (string, error)
func (*SwitchService) SwitchFactorLike ¶
func (s *SwitchService) SwitchFactorLike(ctx *gin.Context, req *dto.SwitchFactorLikeReq) []*admin_model.SwitchFactor
SwitchFactorLike 因子信息列表(全部)
func (*SwitchService) SwitchFactorList ¶
func (s *SwitchService) SwitchFactorList(ctx *gin.Context, req *dto.SwitchFactorListReq) map[string]interface{}
SwitchFactorList 因子信息列表
func (*SwitchService) SwitchList ¶
func (s *SwitchService) SwitchList(ctx *gin.Context, req *dto.SwitchListReq) map[string]interface{}
SwitchList 开关列表
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService 定义了用户相关的服务
func (*UserService) GetAllUserLike ¶
func (s *UserService) GetAllUserLike(ctx context.Context, req *dto.AllUserLikeReq) ([]*admin_model.User, error)
GetAllUserLike 模糊查询所有用户
func (*UserService) GetUserInfo ¶
func (s *UserService) GetUserInfo(userID uint) (*admin_model.User, error)
func (*UserService) GetUsers ¶
func (s *UserService) GetUsers(ctx context.Context, req *dto.UserListReq) map[string]interface{}
GetUsers 获取用户列表
func (*UserService) GetUsersPermissions ¶
func (s *UserService) GetUsersPermissions(ctx context.Context, req *dto.UserPermissionsListReq) []*dto.UserPermissionsListResp
GetUsersPermissions 获取用户列表