Documentation ¶
Index ¶
- func NewRepository(db middleware.Pool) privilege.Repository
- func NewRepositoryWithGlobal() privilege.Repository
- func NewService(repo privilege.Repository, token, loginName string) privilege.Service
- func NewServiceWithDefault(token, loginName string) privilege.Service
- type Repository
- func (r *Repository) Execute(command string, args ...interface{}) (middleware.Result, error)
- func (r *Repository) GetMySQLClusterIDByDBID(dbID int) (int, error)
- func (r *Repository) GetMySQLClusterIDByHostInfo(hostIP string, portNum int) (int, error)
- func (r *Repository) GetMySQLClusterIDByMySQLServerID(mysqlServerID int) (int, error)
- func (r *Repository) GetMySQLClusterIDListByLoginName(loginName string) ([]int, error)
- func (r *Repository) GetUserRoleByLoginName(loginName string) (int, error)
- type Service
- func (s *Service) CheckDBByID(dbID int) error
- func (s *Service) CheckMySQLClusterByID(mysqlClusterID int) error
- func (s *Service) CheckMySQLServerByHostInfo(hostIP string, portNum int) error
- func (s *Service) CheckMySQLServerByID(mysqlServerID int) error
- func (s *Service) GetLoginName() string
- func (s *Service) GetToken() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRepository ¶
func NewRepository(db middleware.Pool) privilege.Repository
NewRepository returns privilege.Repository with given middleware.Pool
func NewRepositoryWithGlobal ¶
func NewRepositoryWithGlobal() privilege.Repository
NewRepositoryWithGlobal returns privilege.Repository with global mysql pool
func NewService ¶
func NewService(repo privilege.Repository, token, loginName string) privilege.Service
NewService returns privilege.Service with given user
func NewServiceWithDefault ¶
NewServiceWithDefault returns privilege.Service with default value
Types ¶
type Repository ¶
type Repository struct {
Database middleware.Pool
}
func (*Repository) Execute ¶
func (r *Repository) Execute(command string, args ...interface{}) (middleware.Result, error)
Execute executes given command and placeholders on the middleware
func (*Repository) GetMySQLClusterIDByDBID ¶
func (r *Repository) GetMySQLClusterIDByDBID(dbID int) (int, error)
GetMySQLClusterIDByDBID gets mysql cluster id by db id
func (*Repository) GetMySQLClusterIDByHostInfo ¶
func (r *Repository) GetMySQLClusterIDByHostInfo(hostIP string, portNum int) (int, error)
GetMySQLClusterIDByHostInfo gets mysql cluster id by mysql server host ip and port number
func (*Repository) GetMySQLClusterIDByMySQLServerID ¶
func (r *Repository) GetMySQLClusterIDByMySQLServerID(mysqlServerID int) (int, error)
GetMySQLClusterIDByMySQLServerID gets mysql cluster id by mysql server id
func (*Repository) GetMySQLClusterIDListByLoginName ¶
func (r *Repository) GetMySQLClusterIDListByLoginName(loginName string) ([]int, error)
GetMySQLClusterIDListByLoginName gets mysql cluster id list by login name
func (*Repository) GetUserRoleByLoginName ¶
func (r *Repository) GetUserRoleByLoginName(loginName string) (int, error)
GetUserRoleByLoginName get user role by login name
type Service ¶
type Service struct { privilege.Repository // contains filtered or unexported fields }
func (*Service) CheckDBByID ¶
CheckDBByID checks if given user has privilege to the database with db id
func (*Service) CheckMySQLClusterByID ¶
CheckMySQLClusterByID checks if given user has privilege to the mysql cluster with mysql cluster id
func (*Service) CheckMySQLServerByHostInfo ¶
CheckMySQLServerByHostInfo checks if given user has privilege to the mysql server with host ip and port number
func (*Service) CheckMySQLServerByID ¶
CheckMySQLServerByID checks if given user has privilege to the mysql server with mysql server id
func (*Service) GetLoginName ¶
GetLoginName returns the login name