metadata

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterTypeSingle = 1
	ClusterTypeShard  = 2
)

Cluster type code

Variables

This section is empty.

Functions

func NewAppInfo

func NewAppInfo(repo metadata.AppRepo, id int, appName string, level int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.App

NewAppInfo returns a new AppInfo

func NewAppInfoWithDefault

func NewAppInfoWithDefault(appName string, level int) metadata.App

NewAppInfoWithDefault returns a new AppInfo with default value

func NewAppInfoWithGlobal

func NewAppInfoWithGlobal(id int, appName string, level int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.App

NewAppInfoWithGlobal NewAppInfo returns a new AppInfo with default AppRepo

func NewAppInfoWithMapAndRandom

func NewAppInfoWithMapAndRandom(fields map[string]interface{}) (metadata.App, error)

NewAppInfoWithMapAndRandom returns a new *AppInfoInfo with given map

func NewAppRepo

func NewAppRepo(db middleware.Pool) metadata.AppRepo

NewAppRepo returns *AppRepo with given middleware.Pool

func NewAppRepoWithGlobal

func NewAppRepoWithGlobal() metadata.AppRepo

NewAppRepoWithGlobal returns *AppRepo with global mysql pool

func NewAppService

func NewAppService(repo metadata.AppRepo) metadata.AppService

NewAppService returns a new *AppService

func NewAppServiceWithDefault

func NewAppServiceWithDefault() metadata.AppService

NewAppServiceWithDefault returns a new *AppService with default repository

func NewDBInfo

func NewDBInfo(repo *DBRepo, id int, dbName string, clusterID int, clusterType int,
	envID int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.DB

NewDBInfo returns a new metadata.App

func NewDBInfoWithDefault

func NewDBInfoWithDefault(dbName string, clusterID, clusterType, envID int) metadata.DB

NewDBInfoWithDefault returns a new metadata.DB with default DBRepo

func NewDBInfoWithGlobal

func NewDBInfoWithGlobal(id int, dbName string, clusterID, clusterType, envID, delFlag int,
	createTime, lastUpdateTime time.Time) metadata.DB

NewDBInfoWithGlobal NewDBInfo returns a new DBInfo with default DBRepo

func NewDBInfoWithMapAndRandom

func NewDBInfoWithMapAndRandom(fields map[string]interface{}) (metadata.DB, error)

NewDBInfoWithMapAndRandom returns a new metadata.DB with given map

func NewDBRepo

func NewDBRepo(db middleware.Pool) metadata.DBRepo

NewDBRepo returns metadata.DBRepo with given middleware.Pool

func NewDBRepoWithGlobal

func NewDBRepoWithGlobal() metadata.DBRepo

NewDBRepoWithGlobal returns metadata.DBRepo with global mysql pool

func NewDBService

func NewDBService(repo metadata.DBRepo) metadata.DBService

NewDBService returns a new metadata.DBService

func NewDBServiceWithDefault

func NewDBServiceWithDefault() metadata.DBService

NewDBServiceWithDefault returns a new metadata.DBService with default repository

func NewEmptyAppInfoWithGlobal

func NewEmptyAppInfoWithGlobal() metadata.App

NewEmptyAppInfoWithGlobal return a new AppInfo

func NewEmptyDBInfoWithGlobal

func NewEmptyDBInfoWithGlobal() metadata.DB

NewEmptyDBInfoWithGlobal return a new DBInfo

func NewEmptyDBInfoWithRepo

func NewEmptyDBInfoWithRepo(repo metadata.DBRepo) metadata.DB

NewEmptyDBInfoWithRepo return a new DBInfo

func NewEmptyEnvInfoWithGlobal

func NewEmptyEnvInfoWithGlobal() metadata.Env

NewEmptyEnvInfoWithGlobal returns a new metadata.Env with global repository

func NewEmptyMiddlewareClusterInfoWithGlobal

func NewEmptyMiddlewareClusterInfoWithGlobal() metadata.MiddlewareCluster

NewEmptyMiddlewareClusterInfoWithGlobal return a new MiddlewareClusterInfo

func NewEmptyMiddlewareServerInfoWithGlobal

func NewEmptyMiddlewareServerInfoWithGlobal() metadata.MiddlewareServer

NewEmptyMiddlewareServerInfoWithGlobal returns a new MiddlewareServer with default MiddlewareServerRepo

func NewEmptyMonitorSystemInfoWithGlobal

func NewEmptyMonitorSystemInfoWithGlobal() metadata.MonitorSystem

NewEmptyMonitorSystemInfoWithGlobal return a new MonitorSystemInfo

func NewEmptyMySQLClusterInfoWithGlobal

func NewEmptyMySQLClusterInfoWithGlobal() metadata.MySQLCluster

NewEmptyMySQLClusterInfoWithGlobal returns a new MySQLClusterInfo with default MySQLClusterRepo

func NewEmptyMySQLServerInfoWithGlobal

func NewEmptyMySQLServerInfoWithGlobal() metadata.MySQLServer

NewEmptyMySQLServerInfoWithGlobal returns a new MySQLServerInfo with default MySQLServerRepo

func NewEmptyResourceGroupInfoWithGlobal added in v1.1.1

func NewEmptyResourceGroupInfoWithGlobal() metadata.ResourceGroup

NewEmptyResourceGroupInfoWithGlobal returns a new ResourceGroupInfo with default ResourceGroupRepo

func NewEmptyResourceRoleInfoWithGlobal added in v1.1.1

func NewEmptyResourceRoleInfoWithGlobal() metadata.ResourceRole

NewEmptyResourceRoleInfoWithGlobal returns a new ResourceRoleInfo with default ResourceRoleRepo

func NewEmptyUserInfoWithGlobal

func NewEmptyUserInfoWithGlobal() metadata.User

NewEmptyUserInfoWithGlobal return userinfo

func NewEnvInfo

func NewEnvInfo(repo metadata.EnvRepo, id int, envName string, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.Env

NewEnvInfo returns a new metadata.Env

func NewEnvInfoWithDefault

func NewEnvInfoWithDefault(envName string) metadata.Env

NewEnvInfoWithDefault returns a new metadata.Env with default EnvRepo

func NewEnvInfoWithGlobal

func NewEnvInfoWithGlobal(id int, envName string, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.Env

NewEnvInfoWithGlobal returns a new metadata.Env with default EnvRepo

func NewEnvInfoWithMapAndRandom

func NewEnvInfoWithMapAndRandom(fields map[string]interface{}) (metadata.Env, error)

NewEnvInfoWithMapAndRandom returns a new metadata.Env with given map

func NewEnvRepo

func NewEnvRepo(db middleware.Pool) metadata.EnvRepo

NewEnvRepo returns metadata.EnvRepo with given middleware.Pool

func NewEnvRepoWithGlobal

func NewEnvRepoWithGlobal() metadata.EnvRepo

NewEnvRepoWithGlobal returns metadata.EnvRepo with global mysql pool

func NewEnvService

func NewEnvService(repo metadata.EnvRepo) metadata.EnvService

NewEnvService returns a new metadata.EnvService

func NewEnvServiceWithDefault

func NewEnvServiceWithDefault() metadata.EnvService

NewEnvServiceWithDefault returns a new metadata.EnvService with default EnvRepo

func NewGroupResourceInfoWithMapAndRandom added in v1.1.1

func NewGroupResourceInfoWithMapAndRandom(fields map[string]interface{}) (metadata.ResourceGroup, error)

NewGroupResourceInfoWithMapAndRandom returns a new metadata.ResourceGroup with given map

func NewMiddlewareClusterInfo

func NewMiddlewareClusterInfo(repo metadata.MiddlewareClusterRepo, id int, middlewareClusterName string, envID int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.MiddlewareCluster

NewMiddlewareClusterInfo returns a new MiddlewareClusterInfo

func NewMiddlewareClusterInfoWithDefault

func NewMiddlewareClusterInfoWithDefault(middlewareClusterName string, envID int) metadata.MiddlewareCluster

NewMiddlewareClusterInfoWithDefault returns a new MiddlewareClusterInfo with default MiddlewareClusterRepo

func NewMiddlewareClusterInfoWithGlobal

func NewMiddlewareClusterInfoWithGlobal(id int, middlewareClusterName string, envID int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.MiddlewareCluster

NewMiddlewareClusterInfoWithGlobal returns a new MiddlewareClusterInfo with default MiddlewareClusterRepo

func NewMiddlewareClusterInfoWithMapAndRandom

func NewMiddlewareClusterInfoWithMapAndRandom(fields map[string]interface{}) (metadata.MiddlewareCluster, error)

NewMiddlewareClusterInfoWithMapAndRandom returns a new metadata.MiddlewareClusterInfo with given map

func NewMiddlewareClusterRepo

func NewMiddlewareClusterRepo(db middleware.Pool) metadata.MiddlewareClusterRepo

NewMiddlewareClusterRepo returns metadata.MiddlewareClusterRepo with given middleware.Pool

func NewMiddlewareClusterRepoWithGlobal

func NewMiddlewareClusterRepoWithGlobal() metadata.MiddlewareClusterRepo

NewMiddlewareClusterRepoWithGlobal returns metadata.MiddlewareClusterRepo with global mysql pool

func NewMiddlewareClusterService

func NewMiddlewareClusterService(repo metadata.MiddlewareClusterRepo) metadata.MiddlewareClusterService

NewMiddlewareClusterService returns a new metadata.MiddlewareClusterService

func NewMiddlewareClusterServiceWithDefault

func NewMiddlewareClusterServiceWithDefault() metadata.MiddlewareClusterService

NewMiddlewareClusterServiceWithDefault returns a new metadata.MiddlewareClusterService with default repository

func NewMiddlewareServerInfo

func NewMiddlewareServerInfo(repo metadata.MiddlewareServerRepo, id int, clusterID int, serverName string, middlewareRole int, hostIP string, portNum int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.MiddlewareServer

NewMiddlewareServerInfo returns a new MiddlewareServerInfo

func NewMiddlewareServerInfoWithDefault

func NewMiddlewareServerInfoWithDefault(clusterID int, serverName string, middlewareRole int, hostIP string, portNum int) metadata.MiddlewareServer

NewMiddlewareServerInfoWithDefault returns a new MiddlewareServerInfo with default MiddlewareServerRepo

func NewMiddlewareServerInfoWithGlobal

func NewMiddlewareServerInfoWithGlobal(id int, clusterID int, serverName string, middlewareRole int, hostIP string, portNum int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.MiddlewareServer

NewMiddlewareServerInfoWithGlobal returns a new MiddlewareServerInfo with default MiddlewareServerRepo

func NewMiddlewareServerInfoWithMapAndRandom

func NewMiddlewareServerInfoWithMapAndRandom(fields map[string]interface{}) (metadata.MiddlewareServer, error)

NewMiddlewareServerInfoWithMapAndRandom returns a new metadata.MiddlewareServer with given map

func NewMiddlewareServerRepo

func NewMiddlewareServerRepo(db middleware.Pool) metadata.MiddlewareServerRepo

NewMiddlewareServerRepo returns metadata.MiddlewareServerRepo with given middleware.Pool

func NewMiddlewareServerRepoWithGlobal

func NewMiddlewareServerRepoWithGlobal() metadata.MiddlewareServerRepo

NewMiddlewareServerRepoWithGlobal returns metadata.MiddlewareServerRepo with global mysql pool

func NewMiddlewareServerService

func NewMiddlewareServerService(repo metadata.MiddlewareServerRepo) metadata.MiddlewareServerService

NewMiddlewareServerService returns a new metadata.MiddlewareServerService

func NewMiddlewareServerServiceWithDefault

func NewMiddlewareServerServiceWithDefault() metadata.MiddlewareServerService

NewMiddlewareServerServiceWithDefault returns a new metadata.MiddlewareServerService with default repository

func NewMonitorSystemInfo

func NewMonitorSystemInfo(repo *MonitorSystemRepo, id int, systemName string, systemType int,
	hostIP string, portNum int, portNumSlow int, baseURL string, envID int, delFlag int,
	createTime time.Time, lastUpdateTime time.Time) metadata.MonitorSystem

NewMonitorSystemInfo returns a new metadata.MonitorSystem

func NewMonitorSystemInfoWithDefault

func NewMonitorSystemInfoWithDefault(systemName string, systemType int, hostIP string, portNum int,
	portNumSlow int, baseURL string, envID int) metadata.MonitorSystem

NewMonitorSystemInfoWithDefault returns a new metadata.MonitorSystem with default MonitorSystemRepo

func NewMonitorSystemInfoWithGlobal

func NewMonitorSystemInfoWithGlobal(id int, systemName string, systemType int, hostIP string, portNum int,
	portNumSlow int, baseURL string, envID int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.MonitorSystem

NewMonitorSystemInfoWithGlobal NewMonitorSystemInfo returns a new MonitorSystemInfo with default MonitorSystemRepo

func NewMonitorSystemInfoWithMapAndRandom

func NewMonitorSystemInfoWithMapAndRandom(fields map[string]interface{}) (metadata.MonitorSystem, error)

NewMonitorSystemInfoWithMapAndRandom returns a new metadata.MonitorSystem with given map

func NewMonitorSystemRepo

func NewMonitorSystemRepo(db middleware.Pool) metadata.MonitorSystemRepo

NewMonitorSystemRepo returns metadata.MonitorSystemRepo with given middleware.Pool

func NewMonitorSystemRepoWithGlobal

func NewMonitorSystemRepoWithGlobal() metadata.MonitorSystemRepo

NewMonitorSystemRepoWithGlobal returns metadata.MonitorSystemRepo with global mysql pool

func NewMonitorSystemService

func NewMonitorSystemService(repo metadata.MonitorSystemRepo) metadata.MonitorSystemService

NewMonitorSystemService returns a new metadata.MonitorSystemService

func NewMonitorSystemServiceWithDefault

func NewMonitorSystemServiceWithDefault() metadata.MonitorSystemService

NewMonitorSystemServiceWithDefault returns a new metadata.MonitorSystemService with default repository

func NewMySQLClusterInfo

func NewMySQLClusterInfo(repo *MySQLClusterRepo,
	id int,
	clusterName string,
	middlewareClusterID int,
	monitorSystemID int,

	envID int,
	delFlag int,
	createTime, lastUpdateTime time.Time) metadata.MySQLCluster

NewMySQLClusterInfo returns a new MySQLClusterInfo

func NewMySQLClusterInfoWithDefault

func NewMySQLClusterInfoWithDefault(
	clusterName string,
	envID int) metadata.MySQLCluster

NewMySQLClusterInfoWithDefault returns a new MySQLClusterInfo with default MySQLClusterRepo

func NewMySQLClusterInfoWithGlobal

func NewMySQLClusterInfoWithGlobal(
	id int,
	clusterName string,
	middlewareClusterID int,
	monitorSystemID int,

	envID int,
	delFlag int,
	createTime, lastUpdateTime time.Time) metadata.MySQLCluster

NewMySQLClusterInfoWithGlobal returns a new MySQLClusterInfo with default MySQLClusterRepo

func NewMySQLClusterInfoWithMapAndRandom

func NewMySQLClusterInfoWithMapAndRandom(fields map[string]interface{}) (metadata.MySQLCluster, error)

NewMySQLClusterInfoWithMapAndRandom returns a new metadata.MySQLCluster with given map

func NewMySQLClusterRepo

func NewMySQLClusterRepo(db middleware.Pool) metadata.MySQLClusterRepo

NewMySQLClusterRepo returns metadata.MySQLClusterRepo with given middleware.Pool

func NewMySQLClusterRepoWithGlobal

func NewMySQLClusterRepoWithGlobal() metadata.MySQLClusterRepo

NewMySQLClusterRepoWithGlobal returns metadata.MySQLClusterRepo with global mysql pool

func NewMySQLClusterService

func NewMySQLClusterService(repo metadata.MySQLClusterRepo) metadata.MySQLClusterService

NewMySQLClusterService returns a new metadata.MySQLClusterService

func NewMySQLClusterServiceWithDefault

func NewMySQLClusterServiceWithDefault() metadata.MySQLClusterService

NewMySQLClusterServiceWithDefault returns a new metadata.MySQLClusterService with default repository

func NewMySQLServerInfo

func NewMySQLServerInfo(repo metadata.MySQLServerRepo,
	id int,
	clusterID int,
	serverName string,
	serviceName string,
	hostIP string,
	portNum int,
	deploymentType int,
	version string,
	delFlag int,
	createTime, lastUpdateTime time.Time) metadata.MySQLServer

NewMySQLServerInfo returns a new MySQLServerInfo

func NewMySQLServerInfoWithDefault

func NewMySQLServerInfoWithDefault(
	clusterID int,
	serverName string,
	hostIP string,
	portNum int,
	deploymentType int) metadata.MySQLServer

NewMySQLServerInfoWithDefault returns a new MySQLServerInfo with default MySQLServerRepo

func NewMySQLServerInfoWithGlobal

func NewMySQLServerInfoWithGlobal(
	id int,
	clusterID int,
	serverName string,
	serviceName string,
	hostIP string,
	portNum int,
	deploymentType int,
	version string,
	delFlag int,
	createTime, lastUpdateTime time.Time) metadata.MySQLServer

NewMySQLServerInfoWithGlobal returns a new MySQLServerInfo with default MySQLServerRepo

func NewMySQLServerInfoWithMapAndRandom

func NewMySQLServerInfoWithMapAndRandom(fields map[string]interface{}) (metadata.MySQLServer, error)

NewMySQLServerInfoWithMapAndRandom returns a new metadata.MySQLServer with given map

func NewMySQLServerRepo

func NewMySQLServerRepo(db middleware.Pool) metadata.MySQLServerRepo

NewMySQLServerRepo returns metadata.MySQLServerRepo with given middleware.Pool

func NewMySQLServerRepoWithGlobal

func NewMySQLServerRepoWithGlobal() metadata.MySQLServerRepo

NewMySQLServerRepoWithGlobal returns metadata.MySQLServerRepo with global mysql pool

func NewMySQLServerService

func NewMySQLServerService(repo metadata.MySQLServerRepo) metadata.MySQLServerService

NewMySQLServerService returns a new metadata.MySQLServerService

func NewMySQLServerServiceWithDefault

func NewMySQLServerServiceWithDefault() metadata.MySQLServerService

NewMySQLServerServiceWithDefault returns a new metadata.MySQLServerService with default repository

func NewResourceGroupInfo added in v1.1.1

func NewResourceGroupInfo(
	repo *ResourceGroupRepo,
	id int,
	groupUUID string,
	groupName string,
	delFlag int,
	createTime, lastUpdateTime time.Time) metadata.ResourceGroup

NewResourceGroupInfo returns a new ResourceGroupInfo

func NewResourceGroupInfoWithDefault added in v1.1.1

func NewResourceGroupInfoWithDefault(groupUUID string, groupName string) metadata.ResourceGroup

NewResourceGroupInfoWithDefault returns a new metadata.ResourceGroup with default ResourceGroupRepo

func NewResourceGroupInfoWithGlobal added in v1.1.1

func NewResourceGroupInfoWithGlobal(
	id int,
	groupUUID string,
	groupName string,
	delFlag int,
	createTime, lastUpdateTime time.Time) metadata.ResourceGroup

NewResourceGroupInfoWithGlobal returns a new ResourceGroupInfo with default ResourceGroupRepo

func NewResourceGroupRepo added in v1.1.1

func NewResourceGroupRepo(db middleware.Pool) metadata.ResourceGroupRepo

NewResourceGroupRepo returns metadata.ResourceGroupRepo with given middleware.Pool

func NewResourceGroupRepoWithGlobal added in v1.1.1

func NewResourceGroupRepoWithGlobal() metadata.ResourceGroupRepo

NewResourceGroupRepoWithGlobal returns metadata.ResourceGroupRepo with global mysql pool

func NewResourceGroupService added in v1.1.1

func NewResourceGroupService(repo metadata.ResourceGroupRepo) metadata.ResourceGroupService

NewResourceGroupService returns a new metadata.ResourceGroupService

func NewResourceGroupServiceWithDefault added in v1.1.1

func NewResourceGroupServiceWithDefault() metadata.ResourceGroupService

NewResourceGroupServiceWithDefault returns a new metadata.ResourceGroupService with default repository

func NewResourceRoleInfo added in v1.1.1

func NewResourceRoleInfo(repo *ResourceRoleRepo,
	id int,
	roleUUID string,
	roleName string,
	delFlag int,
	createTime, lastUpdateTime time.Time) metadata.ResourceRole

NewResourceRoleInfo returns a new ResourceRoleInfo

func NewResourceRoleInfoWithDefault added in v1.1.1

func NewResourceRoleInfoWithDefault(
	roleUUID string,
	resourceGroupID int) metadata.ResourceRole

NewResourceRoleInfoWithDefault returns a new ResourceRoleInfo with default ResourceRoleRepo

func NewResourceRoleInfoWithGlobal added in v1.1.1

func NewResourceRoleInfoWithGlobal(
	id int,
	roleUUID string,
	roleName string,
	resourceGroupID int,
	delFlag int,
	createTime, lastUpdateTime time.Time) metadata.ResourceRole

NewResourceRoleInfoWithGlobal returns a new ResourceRoleInfo with default ResourceRoleRepo

func NewResourceRoleInfoWithMapAndRandom added in v1.1.1

func NewResourceRoleInfoWithMapAndRandom(fields map[string]interface{}) (metadata.ResourceRole, error)

NewResourceRoleInfoWithMapAndRandom returns a new metadata.ResourceRole with given map

func NewResourceRoleRepo added in v1.1.1

func NewResourceRoleRepo(db middleware.Pool) metadata.ResourceRoleRepo

NewResourceRoleRepo returns metadata.ResourceRoleRepo with given middleware.Pool

func NewResourceRoleRepoWithGlobal added in v1.1.1

func NewResourceRoleRepoWithGlobal() metadata.ResourceRoleRepo

NewResourceRoleRepoWithGlobal returns metadata.ResourceRoleRepo with global mysql pool

func NewResourceRoleService added in v1.1.1

func NewResourceRoleService(repo metadata.ResourceRoleRepo) metadata.ResourceRoleService

NewResourceRoleService returns a new metadata.ResourceRoleService

func NewResourceRoleServiceWithDefault added in v1.1.1

func NewResourceRoleServiceWithDefault() metadata.ResourceRoleService

NewResourceRoleServiceWithDefault returns a new metadata.ResourceRoleService with default repository

func NewTableRepo added in v1.1.1

func NewTableRepo(conn *mysql.Conn) metadata.TableRepo

NewTableRepo returns *TableRepo

func NewTableRepoWithDefault added in v1.1.1

func NewTableRepoWithDefault() metadata.TableRepo

NewTableRepoWithDefault returns *TableRepo with default value

func NewTableService added in v1.1.1

func NewTableService(repo metadata.TableRepo) metadata.TableService

NewTableService returns metadata.TableService

func NewTableServiceWithDefault added in v1.1.1

func NewTableServiceWithDefault() metadata.TableService

NewTableServiceWithDefault returns metadata.TableService

func NewUserInfo

func NewUserInfo(repo metadata.UserRepo, id int, userName string, departmentName string, employeeID string, accountName string, email string, telephone string, mobile string, role int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.User

NewUserInfo returns a new UserInfo

func NewUserInfoWithDefault

func NewUserInfoWithDefault(userName string, departmentName string, accountName string, email string, role int) metadata.User

NewUserInfoWithDefault returns a new UserInfo with default UserRepo

func NewUserInfoWithGlobal

func NewUserInfoWithGlobal(id int, userName string, departmentName string, employeeID string, accountName string, email string, telephone string, mobile string, role int, delFlag int, createTime time.Time, lastUpdateTime time.Time) metadata.User

NewUserInfoWithGlobal returns a new UserInfo with default UserRepo

func NewUserInfoWithMapAndRandom

func NewUserInfoWithMapAndRandom(fields map[string]interface{}) (metadata.User, error)

NewUserInfoWithMapAndRandom returns a new metadata.UserInfo with given map

func NewUserRepo

func NewUserRepo(db middleware.Pool) metadata.UserRepo

NewUserRepo returns metadata.UserRepo with given middleware.Pool

func NewUserRepoWithGlobal

func NewUserRepoWithGlobal() metadata.UserRepo

NewUserRepoWithGlobal returns metadata.UserRepo with global mysql pool

func NewUserService

func NewUserService(repo metadata.UserRepo) metadata.UserService

NewUserService returns a new metadata.UserService

func NewUserServiceWithDefault

func NewUserServiceWithDefault() metadata.UserService

NewUserServiceWithDefault returns a new metadata.UserService with default repository

Types

type AppInfo

type AppInfo struct {
	metadata.AppRepo
	ID             int       `middleware:"id" json:"id"`
	AppName        string    `middleware:"app_name" json:"app_name"`
	Level          int       `middleware:"level" json:"level"`
	DelFlag        int       `middleware:"del_flag" json:"del_flag"`
	CreateTime     time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime time.Time `middleware:"last_update_time" json:"last_update_time"`
}

func (*AppInfo) AddDB

func (ai *AppInfo) AddDB(dbID int) error

AddDB adds a new map of the app and database in the middleware

func (*AppInfo) AddUser added in v1.1.1

func (ai *AppInfo) AddUser(userID int) error

AddUser adds a new map of the app and user in the middleware

func (*AppInfo) Delete

func (ai *AppInfo) Delete()

Delete sets DelFlag to 1

func (*AppInfo) DeleteDB

func (ai *AppInfo) DeleteDB(dbID int) error

DeleteDB deletes the map of the app and database in the middleware

func (*AppInfo) DeleteUser added in v1.1.1

func (ai *AppInfo) DeleteUser(userID int) error

DeleteUser deletes the map of the app and user in the middleware

func (*AppInfo) GetAppName

func (ai *AppInfo) GetAppName() string

GetAppName returns the app name

func (*AppInfo) GetCreateTime

func (ai *AppInfo) GetCreateTime() time.Time

GetCreateTime returns the create time

func (*AppInfo) GetDBs added in v1.1.0

func (ai *AppInfo) GetDBs() ([]metadata.DB, error)

GetDBs gets databases that the app uses

func (*AppInfo) GetDelFlag

func (ai *AppInfo) GetDelFlag() int

GetDelFlag returns the delete flag

func (*AppInfo) GetLastUpdateTime

func (ai *AppInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns the last update time

func (*AppInfo) GetLevel

func (ai *AppInfo) GetLevel() int

GetLevel returns the level

func (*AppInfo) GetUsers added in v1.1.1

func (ai *AppInfo) GetUsers() ([]metadata.User, error)

GetUsers gets user list that own the app

func (*AppInfo) Identity

func (ai *AppInfo) Identity() int

Identity returns the identity

func (*AppInfo) MarshalJSON

func (ai *AppInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals App to json bytes

func (*AppInfo) MarshalJSONWithFields

func (ai *AppInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only specified fields of the App to json string

func (*AppInfo) Set

func (ai *AppInfo) Set(fields map[string]interface{}) error

Set sets App with given fields, key is the field name and value is the relevant value of the key

type AppRepo

type AppRepo struct {
	Database middleware.Pool
}

func (*AppRepo) AddDB

func (ar *AppRepo) AddDB(appID, dbID int) error

AddDB adds a new map of app and database in the middleware

func (*AppRepo) AddUser added in v1.1.1

func (ar *AppRepo) AddUser(appID, userID int) error

AddUser adds a new map of app and user in the middleware

func (*AppRepo) Create

func (ar *AppRepo) Create(app metadata.App) (metadata.App, error)

Create creates an app in the middleware

func (*AppRepo) Delete

func (ar *AppRepo) Delete(id int) error

Delete deletes the app in the middleware

func (*AppRepo) DeleteDB

func (ar *AppRepo) DeleteDB(appID, dbID int) error

DeleteDB delete the map of app and database in the middleware

func (*AppRepo) DeleteUser added in v1.1.1

func (ar *AppRepo) DeleteUser(appID, userID int) error

DeleteUser delete the map of app and user in the middleware

func (*AppRepo) Execute

func (ar *AppRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute executes command with arguments on the middleware

func (*AppRepo) GetAll

func (ar *AppRepo) GetAll() ([]metadata.App, error)

GetAll gets all apps from the middleware

func (*AppRepo) GetAppByName

func (ar *AppRepo) GetAppByName(appName string) (metadata.App, error)

GetAppByName gets the app by name from the middleware

func (*AppRepo) GetByID

func (ar *AppRepo) GetByID(id int) (metadata.App, error)

GetByID gets an app by the identity from the middleware

func (*AppRepo) GetDBsByAppID added in v1.1.1

func (ar *AppRepo) GetDBsByAppID(id int) ([]metadata.DB, error)

GetDBsByAppID gets databases that app uses

func (*AppRepo) GetID

func (ar *AppRepo) GetID(systemName string) (int, error)

GetID gets the identity with given app name from the middleware

func (*AppRepo) GetUsersByAppID added in v1.1.1

func (ar *AppRepo) GetUsersByAppID(id int) ([]metadata.User, error)

GetUsersByAppID gets user list that own the app

func (*AppRepo) Transaction

func (ar *AppRepo) Transaction() (middleware.Transaction, error)

Transaction returns a middleware.Transaction that could execute multiple commands as a transaction

func (*AppRepo) Update

func (ar *AppRepo) Update(app metadata.App) error

Update updates the app in the middleware

type AppService

type AppService struct {
	metadata.AppRepo
	Apps  []metadata.App  `json:"apps"`
	DBs   []metadata.DB   `json:"dbs"`
	Users []metadata.User `json:"users"`
}

func (*AppService) AddDB

func (as *AppService) AddDB(appID, dbID int) error

AddDB adds a new map of app and database in the middleware

func (*AppService) AddUser added in v1.1.1

func (as *AppService) AddUser(appID, userID int) error

AddUser adds a new map of app and user in the middleware

func (*AppService) Create

func (as *AppService) Create(fields map[string]interface{}) error

Create creates an app in the middleware

func (*AppService) Delete

func (as *AppService) Delete(id int) error

Delete deletes the app of given id in the middleware

func (*AppService) DeleteDB

func (as *AppService) DeleteDB(appID, dbID int) error

DeleteDB deletes the map of app and database in the middleware

func (*AppService) DeleteUser added in v1.1.1

func (as *AppService) DeleteUser(appID, userID int) error

DeleteUser deletes the map of app and database in the middleware

func (*AppService) GetAll

func (as *AppService) GetAll() error

GetAll gets all apps from the middleware

func (*AppService) GetAppByName

func (as *AppService) GetAppByName(appName string) error

GetAppByName gets App from the middleware by name

func (*AppService) GetApps

func (as *AppService) GetApps() []metadata.App

GetApps returns apps of the service

func (*AppService) GetByID

func (as *AppService) GetByID(id int) error

GetByID gets an app of the given id from the middleware

func (*AppService) GetDBs added in v1.1.0

func (as *AppService) GetDBs() []metadata.DB

GetDBs returns dbs of the service

func (*AppService) GetDBsByAppID added in v1.1.1

func (as *AppService) GetDBsByAppID(id int) error

GetDBsByAppID gets databases that the app uses

func (*AppService) GetUsers added in v1.1.1

func (as *AppService) GetUsers() []metadata.User

GetUsers returns dbs of the service

func (*AppService) GetUsersByAppID added in v1.1.1

func (as *AppService) GetUsersByAppID(id int) error

GetUsersByAppID gets Users that own the app

func (*AppService) Marshal

func (as *AppService) Marshal() ([]byte, error)

Marshal marshals AppService.Apps to json bytes

func (*AppService) MarshalWithFields

func (as *AppService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals only specified fields of the AppService to json bytes

func (*AppService) Update

func (as *AppService) Update(id int, fields map[string]interface{}) error

Update gets the app of the given id from the middleware, and then updates its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

type DBInfo

type DBInfo struct {
	metadata.DBRepo
	ID             int       `middleware:"id" json:"id"`
	DBName         string    `middleware:"db_name" json:"db_name"`
	ClusterID      int       `middleware:"cluster_id" json:"cluster_id"`
	ClusterType    int       `middleware:"cluster_type" json:"cluster_type"`
	EnvID          int       `middleware:"env_id" json:"env_id"`
	DelFlag        int       `middleware:"del_flag" json:"del_flag"`
	CreateTime     time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime time.Time `middleware:"last_update_time" json:"last_update_time"`
}

func (*DBInfo) AddApp

func (di *DBInfo) AddApp(appID int) error

AddApp adds a new map of application system and database in the middleware

func (*DBInfo) DBAddUser added in v1.1.1

func (di *DBInfo) DBAddUser(userID int) error

DBAddUser adds a new map of user and database in the middleware

func (*DBInfo) DBDeleteUser added in v1.1.1

func (di *DBInfo) DBDeleteUser(userID int) error

DBDeleteUser delete the map of user and database in the middleware

func (*DBInfo) Delete

func (di *DBInfo) Delete()

Delete sets DelFlag to 1

func (*DBInfo) DeleteApp

func (di *DBInfo) DeleteApp(appID int) error

DeleteApp delete the map of application system and database in the middleware

func (*DBInfo) GetAllUsers added in v1.1.1

func (di *DBInfo) GetAllUsers() ([]metadata.User, error)

GetAllUsers gets both application and db users of this db

func (*DBInfo) GetAppUsers added in v1.1.1

func (di *DBInfo) GetAppUsers() ([]metadata.User, error)

GetAppUsers gets the application users of this db

func (*DBInfo) GetApps added in v1.1.0

func (di *DBInfo) GetApps() ([]metadata.App, error)

GetApps gets app identity list that uses this db

func (*DBInfo) GetClusterID

func (di *DBInfo) GetClusterID() int

GetClusterID returns the cluster id

func (*DBInfo) GetClusterType

func (di *DBInfo) GetClusterType() int

GetClusterType returns the cluster type

func (*DBInfo) GetCreateTime

func (di *DBInfo) GetCreateTime() time.Time

GetCreateTime returns the create time

func (*DBInfo) GetDBName

func (di *DBInfo) GetDBName() string

GetDBName returns the db name

func (*DBInfo) GetDBUsers added in v1.1.1

func (di *DBInfo) GetDBUsers() ([]metadata.User, error)

GetDBUsers gets the db users of this db

func (*DBInfo) GetDelFlag

func (di *DBInfo) GetDelFlag() int

GetDelFlag returns the delete flag

func (*DBInfo) GetEnvID

func (di *DBInfo) GetEnvID() int

GetEnvID returns the env id

func (*DBInfo) GetLastUpdateTime

func (di *DBInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns the last update time

func (*DBInfo) GetMySQLCluster added in v1.1.0

func (di *DBInfo) GetMySQLCluster() (metadata.MySQLCluster, error)

GetMySQLCluster gets the mysql cluster of this db

func (*DBInfo) Identity

func (di *DBInfo) Identity() int

Identity returns the identity

func (*DBInfo) MarshalJSON

func (di *DBInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals DB to json string

func (*DBInfo) MarshalJSONWithFields

func (di *DBInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only specified field of the DB to json string

func (*DBInfo) Set

func (di *DBInfo) Set(fields map[string]interface{}) error

Set sets DB with given fields, key is the field name and value is the relevant value of the key

type DBRepo

type DBRepo struct {
	Database middleware.Pool
}

func (*DBRepo) AddApp

func (dr *DBRepo) AddApp(dbID, appID int) error

AddApp adds a new map of the app and database in the middleware

func (*DBRepo) Create

func (dr *DBRepo) Create(db metadata.DB) (metadata.DB, error)

Create creates a database in the middleware

func (*DBRepo) DBAddUser added in v1.1.1

func (dr *DBRepo) DBAddUser(dbID, userID int) error

DBAddUser adds a new map of db and user in the middleware

func (*DBRepo) DBDeleteUser added in v1.1.1

func (dr *DBRepo) DBDeleteUser(dbID, userID int) error

DBDeleteUser delete the map of db and user in the middleware

func (*DBRepo) Delete

func (dr *DBRepo) Delete(id int) error

Delete deletes the database in the middleware

func (*DBRepo) DeleteApp

func (dr *DBRepo) DeleteApp(dbID, appID int) error

DeleteApp deletes a map of the app and database in the middleware

func (*DBRepo) Execute

func (dr *DBRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute executes given command and placeholders on the middleware

func (*DBRepo) GetAll

func (dr *DBRepo) GetAll() ([]metadata.DB, error)

GetAll gets all databases from the middleware

func (*DBRepo) GetAllUsersByDBID added in v1.1.1

func (dr *DBRepo) GetAllUsersByDBID(id int) ([]metadata.User, error)

GetAllUsersByDBID gets both application and db users of the given id from the middleware

func (*DBRepo) GetAppUsersByDBID added in v1.1.1

func (dr *DBRepo) GetAppUsersByDBID(id int) ([]metadata.User, error)

GetAppUsersByDBID gets the application users of the given id from the middleware

func (*DBRepo) GetAppsByDBID added in v1.1.1

func (dr *DBRepo) GetAppsByDBID(dbID int) ([]metadata.App, error)

GetAppsByDBID gets an apps that use this db

func (*DBRepo) GetByEnv

func (dr *DBRepo) GetByEnv(envID int) ([]metadata.DB, error)

GetByEnv gets databases of given env id from the middleware

func (*DBRepo) GetByID

func (dr *DBRepo) GetByID(id int) (metadata.DB, error)

GetByID gets a database by the identity from the middleware

func (*DBRepo) GetDBByNameAndClusterInfo added in v1.1.1

func (dr *DBRepo) GetDBByNameAndClusterInfo(name string, clusterID, clusterType int) (metadata.DB, error)

GetDBByNameAndClusterInfo gets a database by the db name and cluster info from the middleware

func (*DBRepo) GetDBByNameAndHostInfo added in v1.1.1

func (dr *DBRepo) GetDBByNameAndHostInfo(name, hostIP string, portNum int) (metadata.DB, error)

GetDBByNameAndHostInfo gets a database by the db name and host info from the middleware

func (*DBRepo) GetDBsByHostInfo added in v1.1.1

func (dr *DBRepo) GetDBsByHostInfo(hostIP string, portNum int) ([]metadata.DB, error)

GetDBsByHostInfo gets databases by the host info from the middleware

func (*DBRepo) GetID

func (dr *DBRepo) GetID(dbName string, clusterID int, clusterType int) (int, error)

GetID gets the identity with given database name, cluster id and cluster type from the middleware

func (*DBRepo) GetMySQLClusterByID added in v1.1.1

func (dr *DBRepo) GetMySQLClusterByID(id int) (metadata.MySQLCluster, error)

GetMySQLClusterByID gets the mysql cluster of the given id from the middleware

func (*DBRepo) GetUsersByDBID added in v1.1.1

func (dr *DBRepo) GetUsersByDBID(id int) ([]metadata.User, error)

GetUsersByDBID gets the db users of the given id from the middleware

func (*DBRepo) Transaction

func (dr *DBRepo) Transaction() (middleware.Transaction, error)

Transaction returns a middleware.Transaction that could execute multiple commands as a transaction

func (*DBRepo) Update

func (dr *DBRepo) Update(db metadata.DB) error

Update updates the database in the middleware

type DBService

type DBService struct {
	metadata.DBRepo
	DBs          []metadata.DB         `json:"dbs"`
	MySQLCluster metadata.MySQLCluster `json:"mysql_cluster"`
	Apps         []metadata.App        `json:"apps"`
	Users        []metadata.User       `json:"users"`
}

func (*DBService) AddApp

func (ds *DBService) AddApp(dbID, appID int) error

AddApp adds a new map of app and database in the middleware

func (*DBService) Create

func (ds *DBService) Create(fields map[string]interface{}) error

Create creates a new database in the middleware

func (*DBService) DBAddUser added in v1.1.1

func (ds *DBService) DBAddUser(dbID, userID int) error

DBAddUser adds a new map of user and database in the middleware

func (*DBService) DBDeleteUser added in v1.1.1

func (ds *DBService) DBDeleteUser(dbID, userID int) error

DBDeleteUser deletes the map of user and database in the middleware

func (*DBService) Delete

func (ds *DBService) Delete(id int) error

Delete deletes the database of given id in the middleware

func (*DBService) DeleteApp

func (ds *DBService) DeleteApp(dbID, appID int) error

DeleteApp deletes the map of app and database in the middleware

func (*DBService) GetAll

func (ds *DBService) GetAll() error

GetAll gets all databases from the middleware

func (*DBService) GetAllUsersByDBID added in v1.1.1

func (ds *DBService) GetAllUsersByDBID(id int) error

GetAllUsersByDBID gets both application and db users of the given id

func (*DBService) GetAppUsersByDBID added in v1.1.1

func (ds *DBService) GetAppUsersByDBID(id int) error

GetAppUsersByDBID gets the application users of the given id

func (*DBService) GetApps added in v1.1.0

func (ds *DBService) GetApps() []metadata.App

GetApps returns the apps of the service

func (*DBService) GetAppsByDBID added in v1.1.1

func (ds *DBService) GetAppsByDBID(dbID int) error

GetAppsByDBID gets apps that uses this db

func (*DBService) GetByEnv

func (ds *DBService) GetByEnv(envID int) error

GetByEnv gets all databases of given env_id

func (*DBService) GetByID

func (ds *DBService) GetByID(id int) error

GetByID gets the database of the given id from the middleware

func (*DBService) GetDBByNameAndClusterInfo added in v1.1.1

func (ds *DBService) GetDBByNameAndClusterInfo(name string, clusterID, clusterType int) error

GetDBByNameAndClusterInfo gets the database of the given db name and cluster info from the middleware

func (*DBService) GetDBByNameAndHostInfo added in v1.1.1

func (ds *DBService) GetDBByNameAndHostInfo(name, hostIP string, portNum int) error

GetDBByNameAndHostInfo gets the database of the given db name and host info from the middleware

func (*DBService) GetDBs

func (ds *DBService) GetDBs() []metadata.DB

GetDBs returns the databases of the service

func (*DBService) GetDBsByHostInfo added in v1.1.1

func (ds *DBService) GetDBsByHostInfo(hostIP string, portNum int) error

GetDBsByHostInfo gets the databases of the given host info from the middleware

func (*DBService) GetMySQLCluster added in v1.1.0

func (ds *DBService) GetMySQLCluster() metadata.MySQLCluster

GetMySQLCluster returns the mysql cluster of the service

func (*DBService) GetMySQLClusterByID added in v1.1.0

func (ds *DBService) GetMySQLClusterByID(id int) error

GetMySQLClusterByID gets the cluster of the db

func (*DBService) GetUsers added in v1.1.1

func (ds *DBService) GetUsers() []metadata.User

GetUsers returns the users of the service

func (*DBService) GetUsersByDBID added in v1.1.1

func (ds *DBService) GetUsersByDBID(id int) error

GetUsersByDBID gets the db users of the given id

func (*DBService) Marshal

func (ds *DBService) Marshal() ([]byte, error)

Marshal marshals DBService.DBs to json bytes

func (*DBService) MarshalWithFields

func (ds *DBService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals only specified fields of the DBService to json bytes

func (*DBService) Update

func (ds *DBService) Update(id int, fields map[string]interface{}) error

Update gets a database of the given id from the middleware, and then updates its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

type EnvInfo

type EnvInfo struct {
	metadata.EnvRepo
	ID             int       `middleware:"id" json:"id"`
	EnvName        string    `middleware:"env_name" json:"env_name"`
	DelFlag        int       `middleware:"del_flag" json:"del_flag"`
	CreateTime     time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime time.Time `middleware:"last_update_time" json:"last_update_time"`
}

func (*EnvInfo) Delete

func (ei *EnvInfo) Delete()

Delete sets DelFlag to 1

func (*EnvInfo) GetCreateTime

func (ei *EnvInfo) GetCreateTime() time.Time

GetCreateTime returns the create time

func (*EnvInfo) GetDelFlag

func (ei *EnvInfo) GetDelFlag() int

GetDelFlag returns the delete flag

func (*EnvInfo) GetEnvName

func (ei *EnvInfo) GetEnvName() string

GetEnvName returns the env name

func (*EnvInfo) GetLastUpdateTime

func (ei *EnvInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns the last update time

func (*EnvInfo) Identity

func (ei *EnvInfo) Identity() int

Identity returns the identity

func (*EnvInfo) MarshalJSON

func (ei *EnvInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals Env to json string

func (*EnvInfo) MarshalJSONWithFields

func (ei *EnvInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only specified fields of Env to json string

func (*EnvInfo) Set

func (ei *EnvInfo) Set(fields map[string]interface{}) error

Set sets entity with given fields, key is the field name and value is the relevant value of the key

type EnvRepo

type EnvRepo struct {
	Database middleware.Pool
}

func (*EnvRepo) Create

func (er *EnvRepo) Create(env metadata.Env) (metadata.Env, error)

Create creates an environment in the middleware

func (*EnvRepo) Delete

func (er *EnvRepo) Delete(id int) error

Delete deletes the environment in the middleware

func (*EnvRepo) Execute

func (er *EnvRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute executes given command and placeholders on the middleware

func (*EnvRepo) GetAll

func (er *EnvRepo) GetAll() ([]metadata.Env, error)

GetAll gets all environments from the middleware

func (*EnvRepo) GetByID

func (er *EnvRepo) GetByID(id int) (metadata.Env, error)

GetByID gets an environment by the identity from the middleware

func (*EnvRepo) GetEnvByName

func (er *EnvRepo) GetEnvByName(envName string) (metadata.Env, error)

GetEnvByName gets Env of given environment name

func (*EnvRepo) GetID

func (er *EnvRepo) GetID(envName string) (int, error)

GetID gets the identity with given environment name from the middleware

func (*EnvRepo) Transaction

func (er *EnvRepo) Transaction() (middleware.Transaction, error)

Transaction returns middleware.PoolConn, so it can run multiple statements in the same transaction

func (*EnvRepo) Update

func (er *EnvRepo) Update(env metadata.Env) error

Update updates the environment in the middleware

type EnvService

type EnvService struct {
	metadata.EnvRepo
	Envs []metadata.Env `json:"envs"`
}

func (*EnvService) Create

func (es *EnvService) Create(fields map[string]interface{}) error

Create creates an environment in the middleware

func (*EnvService) Delete

func (es *EnvService) Delete(id int) error

Delete deletes the environment of given id in the middleware

func (*EnvService) GetAll

func (es *EnvService) GetAll() error

GetAll gets all environments from the middleware

func (*EnvService) GetByID

func (es *EnvService) GetByID(id int) error

GetByID gets an environment of the given id from the middleware

func (*EnvService) GetEnvByName

func (es *EnvService) GetEnvByName(envName string) error

GetEnvByName returns Env of given env name

func (*EnvService) GetEnvs

func (es *EnvService) GetEnvs() []metadata.Env

GetEnvs returns environments of the service

func (*EnvService) GetID

func (es *EnvService) GetID(fields map[string]interface{}) (int, error)

GetID gets identity of an entity with given fields

func (*EnvService) Marshal

func (es *EnvService) Marshal() ([]byte, error)

Marshal marshals EnvService.Envs to json bytes

func (*EnvService) MarshalWithFields

func (es *EnvService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals only specified fields of the EnvService to json bytes

func (*EnvService) Update

func (es *EnvService) Update(id int, fields map[string]interface{}) error

Update gets the environment of the given id from the middleware, and then updates its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

type IndexStatistic added in v1.1.1

type IndexStatistic struct {
	DBName      string `middleware:"db_name" json:"db_name"`
	TableName   string `middleware:"table_name" json:"table_name"`
	IndexName   string `middleware:"index_name" json:"index_name"`
	Sequence    int    `middleware:"sequence" json:"sequence"`
	ColumnName  string `middleware:"column_name" json:"column_name"`
	Cardinality int    `middleware:"cardinality" json:"cardinality"`
	Unique      bool   `middleware:"is_unique" json:"is_unique"`
	Nullable    bool   `middleware:"is_nullable" json:"is_nullable"`
}

IndexStatistic include statistics of index

func NewEmptyIndexStatistic added in v1.1.1

func NewEmptyIndexStatistic() *IndexStatistic

NewEmptyIndexStatistic returns an empty *IndexStatistic

func (*IndexStatistic) GetCardinality added in v1.1.1

func (is *IndexStatistic) GetCardinality() int

GetCardinality returns the cardinality

func (*IndexStatistic) GetColumnName added in v1.1.1

func (is *IndexStatistic) GetColumnName() string

GetColumnName returns the column name

func (*IndexStatistic) GetDBName added in v1.1.1

func (is *IndexStatistic) GetDBName() string

GetDBName returns the table schema

func (*IndexStatistic) GetIndexName added in v1.1.1

func (is *IndexStatistic) GetIndexName() string

GetIndexName returns the index name

func (*IndexStatistic) GetSequence added in v1.1.1

func (is *IndexStatistic) GetSequence() int

GetSequence returns the sequence

func (*IndexStatistic) GetTableName added in v1.1.1

func (is *IndexStatistic) GetTableName() string

GetTableName returns the table name

func (*IndexStatistic) IsNullable added in v1.1.1

func (is *IndexStatistic) IsNullable() bool

IsNullable returns the index is nullable or not

func (*IndexStatistic) IsUnique added in v1.1.1

func (is *IndexStatistic) IsUnique() bool

IsUnique returns unique state of index

func (*IndexStatistic) MarshalJSON added in v1.1.1

func (is *IndexStatistic) MarshalJSON() ([]byte, error)

MarshalJSON marshals Index to json string

type MiddlewareClusterInfo

type MiddlewareClusterInfo struct {
	metadata.MiddlewareClusterRepo
	ID             int       `middleware:"id" json:"id"`
	ClusterName    string    `middleware:"cluster_name" json:"cluster_name"`
	EnvID          int       `middleware:"env_id" json:"env_id"`
	DelFlag        int       `middleware:"del_flag" json:"del_flag"`
	CreateTime     time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime time.Time `middleware:"last_update_time" json:"last_update_time"`
}

func (*MiddlewareClusterInfo) AddUser added in v1.1.1

func (mci *MiddlewareClusterInfo) AddUser(userID int) error

AddUser adds a new map of middleware cluster and user in the middleware

func (*MiddlewareClusterInfo) Delete

func (mci *MiddlewareClusterInfo) Delete()

Delete sets DelFlag to true, need to use Save to write to the middleware

func (*MiddlewareClusterInfo) DeleteUser added in v1.1.1

func (mci *MiddlewareClusterInfo) DeleteUser(userID int) error

DeleteUser deletes a map of middleware cluster and user in the middleware

func (*MiddlewareClusterInfo) GetClusterName

func (mci *MiddlewareClusterInfo) GetClusterName() string

GetClusterName returns the cluster name

func (*MiddlewareClusterInfo) GetCreateTime

func (mci *MiddlewareClusterInfo) GetCreateTime() time.Time

GetCreateTime returns created time of entity

func (*MiddlewareClusterInfo) GetDelFlag

func (mci *MiddlewareClusterInfo) GetDelFlag() int

GetDelFlag returns the delete flag

func (*MiddlewareClusterInfo) GetEnvID

func (mci *MiddlewareClusterInfo) GetEnvID() int

GetEnvID returns the env id

func (*MiddlewareClusterInfo) GetLastUpdateTime

func (mci *MiddlewareClusterInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns last updated time of entity

func (*MiddlewareClusterInfo) GetMiddlewareServers added in v1.1.0

func (mci *MiddlewareClusterInfo) GetMiddlewareServers() ([]metadata.MiddlewareServer, error)

GetMiddlewareServers gets the middleware server id list of this cluster

func (*MiddlewareClusterInfo) GetUsersByMiddlewareClusterID added in v1.1.1

func (mci *MiddlewareClusterInfo) GetUsersByMiddlewareClusterID() ([]metadata.User, error)

GetUsersByMiddlewareClusterID gets user list that own the middleware cluster

func (*MiddlewareClusterInfo) Identity

func (mci *MiddlewareClusterInfo) Identity() int

Identity returns ID of entity

func (*MiddlewareClusterInfo) MarshalJSON

func (mci *MiddlewareClusterInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals entity to json string, it only marshals fields that has default tag

func (*MiddlewareClusterInfo) MarshalJSONWithFields

func (mci *MiddlewareClusterInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only with specified fields of entity to json string

func (*MiddlewareClusterInfo) Set

func (mci *MiddlewareClusterInfo) Set(fields map[string]interface{}) error

Set sets entity with given fields, key is the field name and value is the relevant value of the key

type MiddlewareClusterRepo

type MiddlewareClusterRepo struct {
	Database middleware.Pool
}

func (*MiddlewareClusterRepo) AddUser added in v1.1.1

func (mcr *MiddlewareClusterRepo) AddUser(middlewareClusterID, userID int) error

AddUser adds a new map of middleware cluster and user in the middleware

func (*MiddlewareClusterRepo) Create

Create creates data with given entity in the middleware

func (*MiddlewareClusterRepo) Delete

func (mcr *MiddlewareClusterRepo) Delete(id int) error

Delete deletes the middleware cluster in the middleware

func (*MiddlewareClusterRepo) DeleteUser added in v1.1.1

func (mcr *MiddlewareClusterRepo) DeleteUser(middlewareClusterID, userID int) error

DeleteUser deletes a map of middleware cluster and user in the middleware

func (*MiddlewareClusterRepo) Execute

func (mcr *MiddlewareClusterRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute executes command with arguments on database

func (*MiddlewareClusterRepo) GetAll

GetAll gets all middleware clusters from the middleware

func (*MiddlewareClusterRepo) GetByEnv

func (mcr *MiddlewareClusterRepo) GetByEnv(envID int) ([]metadata.MiddlewareCluster, error)

GetByEnv gets middleware clusters of given env id from the middleware

func (*MiddlewareClusterRepo) GetByID

GetByID gets a middleware cluster by the identity from the middleware

func (*MiddlewareClusterRepo) GetByName

func (mcr *MiddlewareClusterRepo) GetByName(clusterName string) (metadata.MiddlewareCluster, error)

GetByName gets a middleware cluster of given cluster name from the middle ware

func (*MiddlewareClusterRepo) GetID

func (mcr *MiddlewareClusterRepo) GetID(clusterName string, envID int) (int, error)

GetID gets the identity with given cluster name and env id from the middleware

func (*MiddlewareClusterRepo) GetUsersByMiddlewareClusterID added in v1.1.1

func (mcr *MiddlewareClusterRepo) GetUsersByMiddlewareClusterID(clusterID int) ([]metadata.User, error)

GetUsersByMiddlewareClusterID get user list that own the middleware cluster

func (*MiddlewareClusterRepo) Transaction

func (mcr *MiddlewareClusterRepo) Transaction() (middleware.Transaction, error)

Transaction returns a middleware.Transaction that could execute multiple commands as a transaction

func (*MiddlewareClusterRepo) Update

func (mcr *MiddlewareClusterRepo) Update(middlewareCluster metadata.MiddlewareCluster) error

Update updates data with given entity in the middleware

type MiddlewareClusterService

type MiddlewareClusterService struct {
	metadata.MiddlewareClusterRepo
	MiddlewareClusters []metadata.MiddlewareCluster `json:"middleware_clusters"`
	MiddlewareServers  []metadata.MiddlewareServer  `json:"middleware_servers"`
	Users              []metadata.User              `json:"users"`
}

func (*MiddlewareClusterService) AddUser added in v1.1.1

func (mcs *MiddlewareClusterService) AddUser(middlewareClusterID, userID int) error

AddUser adds a new map of middleware cluster and user in the middleware

func (*MiddlewareClusterService) Create

func (mcs *MiddlewareClusterService) Create(fields map[string]interface{}) error

Create creates a new middleware cluster entity and insert it into the middleware

func (*MiddlewareClusterService) Delete

func (mcs *MiddlewareClusterService) Delete(id int) error

Delete deletes the middleware cluster entity that contains the given id in the middleware

func (*MiddlewareClusterService) DeleteUser added in v1.1.1

func (mcs *MiddlewareClusterService) DeleteUser(middlewareClusterID, userID int) error

DeleteUser deletes the map of middleware cluster and user in the middleware

func (*MiddlewareClusterService) GetAll

func (mcs *MiddlewareClusterService) GetAll() error

GetAll gets all middleware cluster entities from the middleware

func (*MiddlewareClusterService) GetByEnv

func (mcs *MiddlewareClusterService) GetByEnv(envID int) error

GetByEnv gets middleware clusters of given env id

func (*MiddlewareClusterService) GetByID

func (mcs *MiddlewareClusterService) GetByID(id int) error

GetByID gets an middleware cluster entity that contains the given id from the middleware

func (*MiddlewareClusterService) GetByName

func (mcs *MiddlewareClusterService) GetByName(clusterName string) error

GetByName gets a middleware cluster of given cluster name

func (*MiddlewareClusterService) GetMiddlewareClusters

func (mcs *MiddlewareClusterService) GetMiddlewareClusters() []metadata.MiddlewareCluster

GetMiddlewareClusters returns middleware clusters of the service

func (*MiddlewareClusterService) GetMiddlewareServers added in v1.1.0

func (mcs *MiddlewareClusterService) GetMiddlewareServers() []metadata.MiddlewareServer

GetMiddlewareServers returns middleware servers of the service

func (*MiddlewareClusterService) GetMiddlewareServersByID added in v1.1.0

func (mcs *MiddlewareClusterService) GetMiddlewareServersByID(clusterID int) error

GetMiddlewareServersByID gets the middleware server id list of given cluster id

func (*MiddlewareClusterService) GetUsers added in v1.1.1

func (mcs *MiddlewareClusterService) GetUsers() []metadata.User

GetUsers returns users of the service

func (*MiddlewareClusterService) GetUsersByMiddlewareClusterID added in v1.1.1

func (mcs *MiddlewareClusterService) GetUsersByMiddlewareClusterID(clusterID int) error

GetUsersByMiddlewareClusterID gets user list that own the middleware cluster

func (*MiddlewareClusterService) Marshal

func (mcs *MiddlewareClusterService) Marshal() ([]byte, error)

Marshal marshals service.Envs

func (*MiddlewareClusterService) MarshalWithFields

func (mcs *MiddlewareClusterService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals service.Envs with given fields

func (*MiddlewareClusterService) Update

func (mcs *MiddlewareClusterService) Update(id int, fields map[string]interface{}) error

Update gets an middleware cluster entity that contains the given id from the middleware, and then update its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

type MiddlewareServerInfo

type MiddlewareServerInfo struct {
	metadata.MiddlewareServerRepo
	ID             int       `middleware:"id" json:"id"`
	ClusterID      int       `middleware:"cluster_id" json:"cluster_id"`
	ServerName     string    `middleware:"server_name" json:"server_name"`
	MiddlewareRole int       `middleware:"middleware_role" json:"middleware_role"`
	HostIP         string    `middleware:"host_ip" json:"host_ip"`
	PortNum        int       `middleware:"port_num" json:"port_num"`
	DelFlag        int       `middleware:"del_flag" json:"del_flag"`
	CreateTime     time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime time.Time `middleware:"last_update_time" json:"last_update_time"`
}

func (*MiddlewareServerInfo) Delete

func (msi *MiddlewareServerInfo) Delete()

Delete sets DelFlag to true, need to use Save to write to the middleware

func (*MiddlewareServerInfo) GetClusterID

func (msi *MiddlewareServerInfo) GetClusterID() int

GetClusterID returns the middleware cluster id

func (*MiddlewareServerInfo) GetCreateTime

func (msi *MiddlewareServerInfo) GetCreateTime() time.Time

GetCreateTime returns created time of entity

func (*MiddlewareServerInfo) GetDelFlag

func (msi *MiddlewareServerInfo) GetDelFlag() int

GetDelFlag checks if delete flag had been set

func (*MiddlewareServerInfo) GetHostIP

func (msi *MiddlewareServerInfo) GetHostIP() string

GetHostIP returns the host ip

func (*MiddlewareServerInfo) GetLastUpdateTime

func (msi *MiddlewareServerInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns last updated time of entity

func (*MiddlewareServerInfo) GetMiddlewareRole

func (msi *MiddlewareServerInfo) GetMiddlewareRole() int

GetMiddlewareRole returns the middleware role

func (*MiddlewareServerInfo) GetPortNum

func (msi *MiddlewareServerInfo) GetPortNum() int

GetPortNum returns the port number

func (*MiddlewareServerInfo) GetServerName

func (msi *MiddlewareServerInfo) GetServerName() string

GetServerName returns the server name

func (*MiddlewareServerInfo) Identity

func (msi *MiddlewareServerInfo) Identity() int

Identity returns ID of entity

func (*MiddlewareServerInfo) MarshalJSON

func (msi *MiddlewareServerInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals entity to json string, it only marshals fields that has default tag

func (*MiddlewareServerInfo) MarshalJSONWithFields

func (msi *MiddlewareServerInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only with specified fields of entity to json string

func (*MiddlewareServerInfo) Set

func (msi *MiddlewareServerInfo) Set(fields map[string]interface{}) error

Set sets entity with given fields, key is the field name and value is the relevant value of the key

type MiddlewareServerRepo

type MiddlewareServerRepo struct {
	Database middleware.Pool
}

func (*MiddlewareServerRepo) Create

Create creates data with given entity in the middleware

func (*MiddlewareServerRepo) Delete

func (msr *MiddlewareServerRepo) Delete(id int) error

Delete deletes the middleware server in the middleware

func (*MiddlewareServerRepo) Execute

func (msr *MiddlewareServerRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute implements dependency.MiddlewareServerRepo interface, it executes command with arguments on database

func (*MiddlewareServerRepo) GetAll

GetAll returns all available entities

func (*MiddlewareServerRepo) GetByClusterID

func (msr *MiddlewareServerRepo) GetByClusterID(clusterID int) ([]metadata.MiddlewareServer, error)

GetByClusterID gets middleware servers with given cluster id

func (*MiddlewareServerRepo) GetByHostInfo

func (msr *MiddlewareServerRepo) GetByHostInfo(hostIP string, portNum int) (metadata.MiddlewareServer, error)

GetByHostInfo gets a middleware server with given host ip and port number

func (*MiddlewareServerRepo) GetByID

GetByID gets a middleware server with given id

func (*MiddlewareServerRepo) GetID

func (msr *MiddlewareServerRepo) GetID(hostIP string, portNum int) (int, error)

GetID checks identity of given entity from the middleware

func (*MiddlewareServerRepo) Transaction

func (msr *MiddlewareServerRepo) Transaction() (middleware.Transaction, error)

Transaction returns a middleware.Transaction that could execute multiple commands as a transaction

func (*MiddlewareServerRepo) Update

func (msr *MiddlewareServerRepo) Update(middlewareServer metadata.MiddlewareServer) error

Update updates data with given entity in the middleware

type MiddlewareServerService

type MiddlewareServerService struct {
	metadata.MiddlewareServerRepo
	MiddlewareServers []metadata.MiddlewareServer `json:"middleware_servers"`
}

func (*MiddlewareServerService) Create

func (mss *MiddlewareServerService) Create(fields map[string]interface{}) error

Create creates a middleware server in the middleware

func (*MiddlewareServerService) Delete

func (mss *MiddlewareServerService) Delete(id int) error

Delete deletes the middleware server of given id in the middleware

func (*MiddlewareServerService) GetAll

func (mss *MiddlewareServerService) GetAll() error

GetAll gets all middleware servers from the middleware

func (*MiddlewareServerService) GetByClusterID

func (mss *MiddlewareServerService) GetByClusterID(clusterID int) error

GetByClusterID gets middleware servers with given cluster id

func (*MiddlewareServerService) GetByHostInfo

func (mss *MiddlewareServerService) GetByHostInfo(hostIP string, portNum int) error

GetByHostInfo gets a middleware server with given host ip and port number

func (*MiddlewareServerService) GetByID

func (mss *MiddlewareServerService) GetByID(id int) error

GetByID gets a middleware server by the identity from the middleware

func (*MiddlewareServerService) GetMiddlewareServers

func (mss *MiddlewareServerService) GetMiddlewareServers() []metadata.MiddlewareServer

GetMiddlewareServers returns middleware servers of the service

func (*MiddlewareServerService) Marshal

func (mss *MiddlewareServerService) Marshal() ([]byte, error)

Marshal marshals MiddlewareServerService.MiddlewareServers to json bytes

func (*MiddlewareServerService) MarshalWithFields

func (mss *MiddlewareServerService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals only specified fields of the MiddlewareServerService to json bytes

func (*MiddlewareServerService) Update

func (mss *MiddlewareServerService) Update(id int, fields map[string]interface{}) error

Update gets a middleware server of the given id from the middleware, and then updates its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

type MonitorSystemInfo

type MonitorSystemInfo struct {
	metadata.MonitorSystemRepo
	ID             int       `middleware:"id" json:"id"`
	SystemName     string    `middleware:"system_name" json:"system_name"`
	SystemType     int       `middleware:"system_type" json:"system_type"`
	HostIP         string    `middleware:"host_ip" json:"host_ip"`
	PortNum        int       `middleware:"port_num" json:"port_num"`
	PortNumSlow    int       `middleware:"port_num_slow" json:"port_num_slow"`
	BaseURL        string    `middleware:"base_url" json:"base_url"`
	EnvID          int       `middleware:"env_id" json:"env_id"`
	DelFlag        int       `middleware:"del_flag" json:"del_flag"`
	CreateTime     time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime time.Time `middleware:"last_update_time" json:"last_update_time"`
}

func (*MonitorSystemInfo) Delete

func (msi *MonitorSystemInfo) Delete()

Delete sets DelFlag to true, need to use Save to write to the middleware

func (*MonitorSystemInfo) GetBaseURL

func (msi *MonitorSystemInfo) GetBaseURL() string

GetBaseURL returns the monitor system baseUrl

func (*MonitorSystemInfo) GetCreateTime

func (msi *MonitorSystemInfo) GetCreateTime() time.Time

GetCreateTime returns created time of entity

func (*MonitorSystemInfo) GetDelFlag

func (msi *MonitorSystemInfo) GetDelFlag() int

GetDelFlag returns the delete flag

func (*MonitorSystemInfo) GetEnvID

func (msi *MonitorSystemInfo) GetEnvID() int

GetEnvID returns the monitor system envID

func (*MonitorSystemInfo) GetHostIP

func (msi *MonitorSystemInfo) GetHostIP() string

GetHostIP returns the monitor system hostIP

func (*MonitorSystemInfo) GetLastUpdateTime

func (msi *MonitorSystemInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns last updated time of entity

func (*MonitorSystemInfo) GetPortNum

func (msi *MonitorSystemInfo) GetPortNum() int

GetPortNum returns the monitor system portNum

func (*MonitorSystemInfo) GetPortNumSlow

func (msi *MonitorSystemInfo) GetPortNumSlow() int

GetPortNumSlow returns the monitor system portNumSlow

func (*MonitorSystemInfo) GetSystemName

func (msi *MonitorSystemInfo) GetSystemName() string

GetSystemName returns the monitor system name

func (*MonitorSystemInfo) GetSystemType

func (msi *MonitorSystemInfo) GetSystemType() int

GetSystemType returns the monitor system type

func (*MonitorSystemInfo) Identity

func (msi *MonitorSystemInfo) Identity() int

Identity returns the identity

func (*MonitorSystemInfo) MarshalJSON

func (msi *MonitorSystemInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals entity to json string, it only marshals fields that has default tag

func (*MonitorSystemInfo) MarshalJSONWithFields

func (msi *MonitorSystemInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only with specified fields of entity to json string

func (*MonitorSystemInfo) Set

func (msi *MonitorSystemInfo) Set(fields map[string]interface{}) error

Set sets monitorSystem with given fields, key is the field name and value is the relevant value of the key

type MonitorSystemRepo

type MonitorSystemRepo struct {
	Database middleware.Pool
}

func (*MonitorSystemRepo) Create

func (msr *MonitorSystemRepo) Create(monitorSystem metadata.MonitorSystem) (metadata.MonitorSystem, error)

Create creates a monitor system in the middleware

func (*MonitorSystemRepo) Delete

func (msr *MonitorSystemRepo) Delete(id int) error

Delete deletes the monitor system in the middleware

func (*MonitorSystemRepo) Execute

func (msr *MonitorSystemRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute executes given command and placeholders on the middleware

func (*MonitorSystemRepo) GetAll

func (msr *MonitorSystemRepo) GetAll() ([]metadata.MonitorSystem, error)

GetAll gets all monitor systems from the middleware

func (*MonitorSystemRepo) GetByEnv

func (msr *MonitorSystemRepo) GetByEnv(envID int) ([]metadata.MonitorSystem, error)

GetByEnv gets monitor systems of given env id from the middleware

func (*MonitorSystemRepo) GetByHostInfo

func (msr *MonitorSystemRepo) GetByHostInfo(hostIP string, portNum int) (metadata.MonitorSystem, error)

GetByHostInfo gets a monitor system by the hostInfo from the middleware

func (*MonitorSystemRepo) GetByID

func (msr *MonitorSystemRepo) GetByID(id int) (metadata.MonitorSystem, error)

GetByID gets a monitor system by the identity from the middleware

func (*MonitorSystemRepo) GetID

func (msr *MonitorSystemRepo) GetID(monitorSystemHostIP string, monitorSystemPortNum int) (int, error)

GetID gets the identity with given host ip and port num from the middleware

func (*MonitorSystemRepo) Transaction

func (msr *MonitorSystemRepo) Transaction() (middleware.Transaction, error)

Transaction returns a middleware.Transaction that could execute multiple commands as a transaction

func (*MonitorSystemRepo) Update

func (msr *MonitorSystemRepo) Update(monitorSystem metadata.MonitorSystem) error

Update updates the monitor system in the middleware

type MonitorSystemService

type MonitorSystemService struct {
	metadata.MonitorSystemRepo
	MonitorSystems []metadata.MonitorSystem `json:"monitor_systems"`
}

func (*MonitorSystemService) Create

func (mss *MonitorSystemService) Create(fields map[string]interface{}) error

Create creates an new monitor system in the middleware

func (*MonitorSystemService) Delete

func (mss *MonitorSystemService) Delete(id int) error

Delete deletes the monitor system of given id in the middleware

func (*MonitorSystemService) GetAll

func (mss *MonitorSystemService) GetAll() error

GetAll gets all monitor systems from the middleware

func (*MonitorSystemService) GetByEnv

func (mss *MonitorSystemService) GetByEnv(envID int) error

GetByEnv gets all monitor systems from the middleware by env_id

func (*MonitorSystemService) GetByHostInfo

func (mss *MonitorSystemService) GetByHostInfo(hostIP string, portNum int) error

GetByHostInfo gets monitor system from the middleware by host_info

func (*MonitorSystemService) GetByID

func (mss *MonitorSystemService) GetByID(id int) error

GetByID gets an monitor system of the given id from the middleware

func (*MonitorSystemService) GetMonitorSystems

func (mss *MonitorSystemService) GetMonitorSystems() []metadata.MonitorSystem

GetMonitorSystems returns monitor systems of the service

func (*MonitorSystemService) Marshal

func (mss *MonitorSystemService) Marshal() ([]byte, error)

Marshal marshals MonitorSystemService.MonitorSystems to json bytes

func (*MonitorSystemService) MarshalWithFields

func (mss *MonitorSystemService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals only specified fields of the MonitorSystemService to json bytes

func (*MonitorSystemService) Update

func (mss *MonitorSystemService) Update(id int, fields map[string]interface{}) error

Update gets the monitor system of the given id from the middleware, and then update its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

type MySQLClusterInfo

type MySQLClusterInfo struct {
	MySQLClusterRepo    metadata.MySQLClusterRepo
	ID                  int       `middleware:"id" json:"id"`
	ClusterName         string    `middleware:"cluster_name" json:"cluster_name"`
	MiddlewareClusterID int       `middleware:"middleware_cluster_id" json:"middleware_cluster_id"`
	MonitorSystemID     int       `middleware:"monitor_system_id" json:"monitor_system_id"`
	EnvID               int       `middleware:"env_id" json:"env_id"`
	DelFlag             int       `middleware:"del_flag" json:"del_flag"`
	CreateTime          time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime      time.Time `middleware:"last_update_time" json:"last_update_time"`
}

MySQLClusterInfo is a struct map to table in the database

func (*MySQLClusterInfo) AddUser added in v1.1.1

func (mci *MySQLClusterInfo) AddUser(userID int) error

AddUser add a user for mysql cluster in the middleware

func (*MySQLClusterInfo) Delete

func (mci *MySQLClusterInfo) Delete()

Delete sets DelFlag to true, need to use Save to write to the middleware

func (*MySQLClusterInfo) DeleteUser added in v1.1.1

func (mci *MySQLClusterInfo) DeleteUser(userID int) error

DeleteUser delete a user for mysql cluster in the middleware

func (*MySQLClusterInfo) GetAllUsers added in v1.1.1

func (mci *MySQLClusterInfo) GetAllUsers() ([]metadata.User, error)

GetAllUsers gets both application and db users of this cluster

func (*MySQLClusterInfo) GetAppUsers added in v1.1.1

func (mci *MySQLClusterInfo) GetAppUsers() ([]metadata.User, error)

GetAppUsers gets the application users of this cluster

func (*MySQLClusterInfo) GetClusterName

func (mci *MySQLClusterInfo) GetClusterName() string

GetClusterName returns the env name

func (*MySQLClusterInfo) GetCreateTime

func (mci *MySQLClusterInfo) GetCreateTime() time.Time

GetCreateTime returns created time of mysql cluster

func (*MySQLClusterInfo) GetDBUsers added in v1.1.1

func (mci *MySQLClusterInfo) GetDBUsers() ([]metadata.User, error)

GetDBUsers gets the db users of this cluster

func (*MySQLClusterInfo) GetDBs added in v1.1.0

func (mci *MySQLClusterInfo) GetDBs() ([]metadata.DB, error)

GetDBs gets the databases of this cluster

func (*MySQLClusterInfo) GetDelFlag

func (mci *MySQLClusterInfo) GetDelFlag() int

GetDelFlag returns the delete flag

func (*MySQLClusterInfo) GetEnvID

func (mci *MySQLClusterInfo) GetEnvID() int

GetEnvID returns the env id

func (*MySQLClusterInfo) GetLastUpdateTime

func (mci *MySQLClusterInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns last updated time of mysql cluster

func (*MySQLClusterInfo) GetMasterServers added in v1.1.0

func (mci *MySQLClusterInfo) GetMasterServers() ([]metadata.MySQLServer, error)

GetMasterServers gets the master servers of this cluster

func (*MySQLClusterInfo) GetMiddlewareClusterID

func (mci *MySQLClusterInfo) GetMiddlewareClusterID() int

GetMiddlewareClusterID returns the middleware cluster id

func (*MySQLClusterInfo) GetMonitorSystemID

func (mci *MySQLClusterInfo) GetMonitorSystemID() int

GetMonitorSystemID returns the monitor system id

func (*MySQLClusterInfo) GetMySQLServers added in v1.1.0

func (mci *MySQLClusterInfo) GetMySQLServers() ([]metadata.MySQLServer, error)

GetMySQLServers gets the mysql servers of this cluster

func (*MySQLClusterInfo) GetResourceGroup added in v1.1.1

func (mci *MySQLClusterInfo) GetResourceGroup() (metadata.ResourceGroup, error)

GetResourceGroup get the resource group of the given id from the middleware

func (*MySQLClusterInfo) GetUsers added in v1.1.1

func (mci *MySQLClusterInfo) GetUsers() ([]metadata.User, error)

GetUsers gets the users of this cluster

func (*MySQLClusterInfo) Identity

func (mci *MySQLClusterInfo) Identity() int

Identity cluster returns ID of mysql cluster

func (*MySQLClusterInfo) MarshalJSON

func (mci *MySQLClusterInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals mysql cluster to json string, it only marshals fields that has default tag

func (*MySQLClusterInfo) MarshalJSONWithFields

func (mci *MySQLClusterInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only with specified fields of mysql cluster to json string

func (*MySQLClusterInfo) Set

func (mci *MySQLClusterInfo) Set(fields map[string]interface{}) error

Set sets mysql cluster with given fields, key is the field name and value is the relevant value of the key

type MySQLClusterRepo

type MySQLClusterRepo struct {
	Database middleware.Pool
}

MySQLClusterRepo implements dependency.MySQLClusterRepo interface

func (*MySQLClusterRepo) AddUser added in v1.1.1

func (mcr *MySQLClusterRepo) AddUser(mysqlClusterID, userID int) error

AddUser add a user for mysql cluster in the middleware

func (*MySQLClusterRepo) Create

func (mcr *MySQLClusterRepo) Create(mysqlCluster metadata.MySQLCluster) (metadata.MySQLCluster, error)

Create creates data with given entity in the middleware

func (*MySQLClusterRepo) Delete

func (mcr *MySQLClusterRepo) Delete(id int) error

Delete deletes data in the middleware, it is recommended to use soft deletion, therefore use update instead of delete

func (*MySQLClusterRepo) DeleteUser added in v1.1.1

func (mcr *MySQLClusterRepo) DeleteUser(mysqlClusterID, userID int) error

DeleteUser delete a user for mysql cluster in the middleware

func (*MySQLClusterRepo) Execute

func (mcr *MySQLClusterRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute implements metadata.MySQLClusterRepo interface, it executes command with arguments on database

func (*MySQLClusterRepo) GetAll

func (mcr *MySQLClusterRepo) GetAll() ([]metadata.MySQLCluster, error)

GetAll returns all available entities

func (*MySQLClusterRepo) GetAllUsersByID added in v1.1.1

func (mcr *MySQLClusterRepo) GetAllUsersByID(id int) ([]metadata.User, error)

GetAllUsersByID gets both application and db users of the given id from the middleware

func (*MySQLClusterRepo) GetAppUsersByID added in v1.1.1

func (mcr *MySQLClusterRepo) GetAppUsersByID(id int) ([]metadata.User, error)

GetAppUsersByID gets the application users of the given id from the middleware

func (*MySQLClusterRepo) GetByEnv

func (mcr *MySQLClusterRepo) GetByEnv(envID int) ([]metadata.MySQLCluster, error)

GetByEnv gets mysql clusters of given env id from the middleware

func (*MySQLClusterRepo) GetByID

func (mcr *MySQLClusterRepo) GetByID(id int) (metadata.MySQLCluster, error)

GetByID Select returns an available entity of the given id

func (*MySQLClusterRepo) GetByName

func (mcr *MySQLClusterRepo) GetByName(clusterName string) (metadata.MySQLCluster, error)

GetByName gets a mysql cluster of given cluster name from the middle ware

func (*MySQLClusterRepo) GetDBUsersByID added in v1.1.1

func (mcr *MySQLClusterRepo) GetDBUsersByID(id int) ([]metadata.User, error)

GetDBUsersByID gets the db users of the given id from the middleware

func (*MySQLClusterRepo) GetDBsByID added in v1.1.0

func (mcr *MySQLClusterRepo) GetDBsByID(id int) ([]metadata.DB, error)

GetDBsByID gets the databases of the given id from the middleware

func (*MySQLClusterRepo) GetID

func (mcr *MySQLClusterRepo) GetID(clusterName string) (int, error)

GetID checks identity of given entity from the middleware

func (*MySQLClusterRepo) GetResourceGroupByID added in v1.1.1

func (mcr *MySQLClusterRepo) GetResourceGroupByID(id int) (metadata.ResourceGroup, error)

GetResourceGroupByID get the resource group of the given id from the middleware

func (*MySQLClusterRepo) GetUsersByID added in v1.1.1

func (mcr *MySQLClusterRepo) GetUsersByID(id int) ([]metadata.User, error)

GetUsersByID gets the users of the given id from the middleware

func (*MySQLClusterRepo) Transaction

func (mcr *MySQLClusterRepo) Transaction() (middleware.Transaction, error)

Transaction returns middleware.PoolConn

func (*MySQLClusterRepo) Update

func (mcr *MySQLClusterRepo) Update(entity metadata.MySQLCluster) error

Update updates data with given entity in the middleware

type MySQLClusterService

type MySQLClusterService struct {
	MySQLClusterRepo metadata.MySQLClusterRepo
	MySQLClusters    []metadata.MySQLCluster `json:"mysql_clusters"`
	MySQLServers     []metadata.MySQLServer  `json:"mysql_servers"`
	DBs              []metadata.DB           `json:"dbs"`
	Users            []metadata.User         `json:"users"`
	ResourceGroup    metadata.ResourceGroup  `json:"resource_group"`
}

MySQLClusterService implements Service interface

func (*MySQLClusterService) AddUser added in v1.1.1

func (mcs *MySQLClusterService) AddUser(mysqlClusterID, userID int) error

AddUser adds a new map of mysql cluster and user in the middleware

func (*MySQLClusterService) Create

func (mcs *MySQLClusterService) Create(fields map[string]interface{}) error

Create creates a new mysql cluster entity and insert it into the middleware

func (*MySQLClusterService) Delete

func (mcs *MySQLClusterService) Delete(id int) error

Delete deletes the mysql cluster entity that contains the given id in the middleware

func (*MySQLClusterService) DeleteUser added in v1.1.1

func (mcs *MySQLClusterService) DeleteUser(mysqlClusterID, userID int) error

DeleteUser deletes the map of mysql cluster and user in the middleware

func (*MySQLClusterService) GetAll

func (mcs *MySQLClusterService) GetAll() error

GetAll gets all mysql cluster entities from the middleware

func (*MySQLClusterService) GetAllUsersByID added in v1.1.1

func (mcs *MySQLClusterService) GetAllUsersByID(id int) error

GetAllUsersByID gets both application and db users of the given id

func (*MySQLClusterService) GetAppUsersByID added in v1.1.1

func (mcs *MySQLClusterService) GetAppUsersByID(id int) error

GetAppUsersByID gets the application users of the given id

func (*MySQLClusterService) GetByEnv

func (mcs *MySQLClusterService) GetByEnv(envID int) error

GetByEnv gets mysql clusters of given env id

func (*MySQLClusterService) GetByID

func (mcs *MySQLClusterService) GetByID(id int) error

GetByID gets a mysql cluster entity that contains the given id from the middleware

func (*MySQLClusterService) GetByName

func (mcs *MySQLClusterService) GetByName(clusterName string) error

GetByName gets a mysql cluster of given cluster name

func (*MySQLClusterService) GetDBUsersByID added in v1.1.1

func (mcs *MySQLClusterService) GetDBUsersByID(id int) error

GetDBUsersByID gets the db users of the given id

func (*MySQLClusterService) GetDBs added in v1.1.0

func (mcs *MySQLClusterService) GetDBs() []metadata.DB

GetDBs returns the dbs of the service

func (*MySQLClusterService) GetDBsByID added in v1.1.0

func (mcs *MySQLClusterService) GetDBsByID(id int) error

GetDBsByID gets the databases of the given id

func (*MySQLClusterService) GetMasterServersByID added in v1.1.0

func (mcs *MySQLClusterService) GetMasterServersByID(id int) error

GetMasterServersByID gets the master servers of this cluster

func (*MySQLClusterService) GetMySQLClusters

func (mcs *MySQLClusterService) GetMySQLClusters() []metadata.MySQLCluster

GetMySQLClusters returns the mysql clusters of the service

func (*MySQLClusterService) GetMySQLServers added in v1.1.0

func (mcs *MySQLClusterService) GetMySQLServers() []metadata.MySQLServer

GetMySQLServers returns the mysql servers of the service

func (*MySQLClusterService) GetMySQLServersByID added in v1.1.0

func (mcs *MySQLClusterService) GetMySQLServersByID(id int) error

GetMySQLServersByID gets the mysql servers of given id

func (*MySQLClusterService) GetResourceGroup added in v1.1.1

func (mcs *MySQLClusterService) GetResourceGroup() metadata.ResourceGroup

GetResourceGroup returns the dbs of the service

func (*MySQLClusterService) GetResourceGroupByID added in v1.1.1

func (mcs *MySQLClusterService) GetResourceGroupByID(id int) error

GetResourceGroupByID get the resource group of the given id from the middleware

func (*MySQLClusterService) GetUsers added in v1.1.1

func (mcs *MySQLClusterService) GetUsers() []metadata.User

GetUsers returns the users of the service

func (*MySQLClusterService) GetUsersByID added in v1.1.1

func (mcs *MySQLClusterService) GetUsersByID(id int) error

GetUsersByID gets the users of the given id

func (*MySQLClusterService) Marshal

func (mcs *MySQLClusterService) Marshal() ([]byte, error)

Marshal marshals service.Envs

func (*MySQLClusterService) MarshalWithFields

func (mcs *MySQLClusterService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals service.Envs with given fields

func (*MySQLClusterService) Update

func (mcs *MySQLClusterService) Update(id int, fields map[string]interface{}) error

Update gets an mysql cluster entity that contains the given id from the middleware, and then update its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

type MySQLServerInfo

type MySQLServerInfo struct {
	metadata.MySQLServerRepo
	ID             int       `middleware:"id" json:"id"`
	ClusterID      int       `middleware:"cluster_id" json:"cluster_id"`
	ServerName     string    `middleware:"server_name" json:"server_name"`
	ServiceName    string    `middleware:"service_name" json:"service_name"`
	HostIP         string    `middleware:"host_ip" json:"host_ip"`
	PortNum        int       `middleware:"port_num" json:"port_num"`
	DeploymentType int       `middleware:"deployment_type" json:"deployment_type"`
	Version        string    `middleware:"version" json:"version"`
	DelFlag        int       `middleware:"del_flag" json:"del_flag"`
	CreateTime     time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime time.Time `middleware:"last_update_time" json:"last_update_time"`
}

MySQLServerInfo is a struct map to table in the database

func (*MySQLServerInfo) Delete

func (msi *MySQLServerInfo) Delete()

Delete sets DelFlag to true, need to use Save to write to the middleware

func (*MySQLServerInfo) GetClusterID

func (msi *MySQLServerInfo) GetClusterID() int

GetClusterID returns the mysql cluster id

func (*MySQLServerInfo) GetCreateTime

func (msi *MySQLServerInfo) GetCreateTime() time.Time

GetCreateTime returns created time of entity

func (*MySQLServerInfo) GetDelFlag

func (msi *MySQLServerInfo) GetDelFlag() int

GetDelFlag returns the delete flag

func (*MySQLServerInfo) GetDeploymentType

func (msi *MySQLServerInfo) GetDeploymentType() int

GetDeploymentType returns the deployment type

func (*MySQLServerInfo) GetHostIP

func (msi *MySQLServerInfo) GetHostIP() string

GetHostIP returns the host ip

func (*MySQLServerInfo) GetLastUpdateTime

func (msi *MySQLServerInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns last updated time of entity

func (*MySQLServerInfo) GetMonitorSystem

func (msi *MySQLServerInfo) GetMonitorSystem() (metadata.MonitorSystem, error)

GetMonitorSystem gets monitor system of this server

func (*MySQLServerInfo) GetMySQLCluster added in v1.1.0

func (msi *MySQLServerInfo) GetMySQLCluster() (metadata.MySQLCluster, error)

GetMySQLCluster gets mysql cluster of this server

func (*MySQLServerInfo) GetPortNum

func (msi *MySQLServerInfo) GetPortNum() int

GetPortNum returns the port number

func (*MySQLServerInfo) GetServerName

func (msi *MySQLServerInfo) GetServerName() string

GetServerName returns the server name

func (*MySQLServerInfo) GetServiceName

func (msi *MySQLServerInfo) GetServiceName() string

GetServiceName returns the service name

func (*MySQLServerInfo) GetVersion

func (msi *MySQLServerInfo) GetVersion() string

GetVersion returns the version

func (*MySQLServerInfo) Identity

func (msi *MySQLServerInfo) Identity() int

Identity returns ID of entity

func (*MySQLServerInfo) IsMaster added in v1.1.0

func (msi *MySQLServerInfo) IsMaster() (bool, error)

IsMaster returns if this mysql server is a master node

func (*MySQLServerInfo) MarshalJSON

func (msi *MySQLServerInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals entity to json string, it only marshals fields that has default tag

func (*MySQLServerInfo) MarshalJSONWithFields

func (msi *MySQLServerInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only with specified fields of entity to json string

func (*MySQLServerInfo) Set

func (msi *MySQLServerInfo) Set(fields map[string]interface{}) error

Set sets entity with given fields, key is the field name and value is the relevant value of the key

type MySQLServerRepo

type MySQLServerRepo struct {
	Database middleware.Pool
}

MySQLServerRepo implements dependency.MySQLServerRepo interface

func (*MySQLServerRepo) Create

func (msr *MySQLServerRepo) Create(mysqlServer metadata.MySQLServer) (metadata.MySQLServer, error)

Create creates data with given mysqlServer in the middleware

func (*MySQLServerRepo) Delete

func (msr *MySQLServerRepo) Delete(id int) error

Delete deletes data in the middleware, it is recommended to use soft deletion, therefore use update instead of delete

func (*MySQLServerRepo) Execute

func (msr *MySQLServerRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute implements dependency.MySQLServerRepo interface, it executes command with arguments on database

func (*MySQLServerRepo) GetAll

func (msr *MySQLServerRepo) GetAll() ([]metadata.MySQLServer, error)

GetAll returns all available entities

func (*MySQLServerRepo) GetByClusterID

func (msr *MySQLServerRepo) GetByClusterID(clusterID int) ([]metadata.MySQLServer, error)

GetByClusterID Select returns an available mysqlServer of the given cluster id

func (*MySQLServerRepo) GetByHostInfo

func (msr *MySQLServerRepo) GetByHostInfo(hostIP string, portNum int) (metadata.MySQLServer, error)

GetByHostInfo gets a mysql server with given host ip and port number

func (*MySQLServerRepo) GetByID

func (msr *MySQLServerRepo) GetByID(id int) (metadata.MySQLServer, error)

GetByID Select returns an available mysqlServer of the given id

func (*MySQLServerRepo) GetID

func (msr *MySQLServerRepo) GetID(hostIP string, portNum int) (int, error)

GetID gets the identity with given host ip and port number from the mysql

func (*MySQLServerRepo) GetMonitorSystem

func (msr *MySQLServerRepo) GetMonitorSystem(id int) (metadata.MonitorSystem, error)

GetMonitorSystem gets monitor system with given mysql server id from the mysql

func (*MySQLServerRepo) GetMySQLClusterByID added in v1.1.0

func (msr *MySQLServerRepo) GetMySQLClusterByID(id int) (metadata.MySQLCluster, error)

GetMySQLClusterByID gets the mysql cluster of the given id

func (*MySQLServerRepo) IsMaster added in v1.1.0

func (msr *MySQLServerRepo) IsMaster(hostIP string, portNum int) (bool, error)

IsMaster returns if mysql server of given host ip and port number is a master node

func (*MySQLServerRepo) Transaction

func (msr *MySQLServerRepo) Transaction() (middleware.Transaction, error)

Transaction returns middleware.PoolConn

func (*MySQLServerRepo) Update

func (msr *MySQLServerRepo) Update(mysqlServer metadata.MySQLServer) error

Update updates data with given mysqlServer in the middleware

type MySQLServerService

type MySQLServerService struct {
	MySQLServerRepo metadata.MySQLServerRepo
	MySQLServers    []metadata.MySQLServer `json:"mysql_servers"`
	MySQLCluster    metadata.MySQLCluster  `json:"mysql_cluster"`
}

MySQLServerService implements Service interface

func (*MySQLServerService) Create

func (mss *MySQLServerService) Create(fields map[string]interface{}) error

Create creates a new mysql server entity and insert it into the middleware

func (*MySQLServerService) Delete

func (mss *MySQLServerService) Delete(id int) error

Delete deletes the mysql server entity that contains the given id in the middleware

func (*MySQLServerService) GetAll

func (mss *MySQLServerService) GetAll() error

GetAll gets all mysql server entities from the middleware

func (*MySQLServerService) GetByClusterID

func (mss *MySQLServerService) GetByClusterID(clusterID int) error

GetByClusterID gets mysql servers with given cluster id

func (*MySQLServerService) GetByHostInfo

func (mss *MySQLServerService) GetByHostInfo(hostIP string, portNum int) error

GetByHostInfo gets a mysql server with given host ip and port number

func (*MySQLServerService) GetByID

func (mss *MySQLServerService) GetByID(id int) error

GetByID gets an mysql server entity that contains the given id from the middleware

func (*MySQLServerService) GetMySQLCluster added in v1.1.0

func (mss *MySQLServerService) GetMySQLCluster() metadata.MySQLCluster

GetMySQLCluster returns the mysql cluster of the service

func (*MySQLServerService) GetMySQLClusterByID added in v1.1.0

func (mss *MySQLServerService) GetMySQLClusterByID(id int) error

GetMySQLClusterByID gets the mysql cluster of the given id

func (*MySQLServerService) GetMySQLServers

func (mss *MySQLServerService) GetMySQLServers() []metadata.MySQLServer

GetMySQLServers returns the mysql servers of the service

func (*MySQLServerService) IsMaster added in v1.1.0

func (mss *MySQLServerService) IsMaster(hostIP string, portNum int) (bool, error)

IsMaster returns if mysql server with given host ip and port number is a master node

func (*MySQLServerService) Marshal

func (mss *MySQLServerService) Marshal() ([]byte, error)

Marshal marshals service.Envs

func (*MySQLServerService) MarshalWithFields

func (mss *MySQLServerService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals service.Envs with given fields

func (*MySQLServerService) Update

func (mss *MySQLServerService) Update(id int, fields map[string]interface{}) error

Update gets an mysql server entity that contains the given id from the middleware, and then update its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

type ResourceGroupInfo added in v1.1.1

type ResourceGroupInfo struct {
	ResourceGroupRepo metadata.ResourceGroupRepo
	ID                int       `middleware:"id" json:"id"`
	GroupUUID         string    `middleware:"group_uuid" json:"group_uuid"`
	GroupName         string    `middleware:"group_name" json:"group_name"`
	DelFlag           int       `middleware:"del_flag" json:"del_flag"`
	CreateTime        time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime    time.Time `middleware:"last_update_time" json:"last_update_time"`
}

func (*ResourceGroupInfo) AddMiddlewareCluster added in v1.1.1

func (rgi *ResourceGroupInfo) AddMiddlewareCluster(mysqlClusterID int) error

AddMiddlewareCluster adds middleware cluster to the resource group

func (*ResourceGroupInfo) AddMySQLCluster added in v1.1.1

func (rgi *ResourceGroupInfo) AddMySQLCluster(mysqlClusterID int) error

AddMySQLCluster adds mysql cluster to the resource group

func (*ResourceGroupInfo) AddResourceRole added in v1.1.1

func (rgi *ResourceGroupInfo) AddResourceRole(resourceRoleID int) error

AddResourceRole adds resource role to the resource group

func (*ResourceGroupInfo) Delete added in v1.1.1

func (rgi *ResourceGroupInfo) Delete()

Delete sets DelFlag to 1

func (*ResourceGroupInfo) DeleteMiddlewareCluster added in v1.1.1

func (rgi *ResourceGroupInfo) DeleteMiddlewareCluster(middlewareClusterID int) error

DeleteMiddlewareCluster deletes middleware cluster from the resource group

func (*ResourceGroupInfo) DeleteMySQLCluster added in v1.1.1

func (rgi *ResourceGroupInfo) DeleteMySQLCluster(mysqlClusterID int) error

DeleteMySQLCluster deletes mysql cluster from the resource group

func (*ResourceGroupInfo) DeleteResourceRole added in v1.1.1

func (rgi *ResourceGroupInfo) DeleteResourceRole(middlewareClusterID int) error

DeleteResourceRole deletes resource role from the resource group

func (*ResourceGroupInfo) GetCreateTime added in v1.1.1

func (rgi *ResourceGroupInfo) GetCreateTime() time.Time

GetCreateTime returns the CreateTime

func (*ResourceGroupInfo) GetDASAdminUsers added in v1.1.1

func (rgi *ResourceGroupInfo) GetDASAdminUsers() ([]metadata.User, error)

GetDASAdminUsers gets the das admin users of this resource group

func (*ResourceGroupInfo) GetDelFlag added in v1.1.1

func (rgi *ResourceGroupInfo) GetDelFlag() int

GetDelFlag returns the DelFlag

func (*ResourceGroupInfo) GetGroupName added in v1.1.1

func (rgi *ResourceGroupInfo) GetGroupName() string

GetGroupName returns the GroupName

func (*ResourceGroupInfo) GetGroupUUID added in v1.1.1

func (rgi *ResourceGroupInfo) GetGroupUUID() string

GetGroupUUID returns the GroupUUID

func (*ResourceGroupInfo) GetLastUpdateTime added in v1.1.1

func (rgi *ResourceGroupInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns the LastUpdateTime

func (*ResourceGroupInfo) GetMiddlewareClusters added in v1.1.1

func (rgi *ResourceGroupInfo) GetMiddlewareClusters() ([]metadata.MiddlewareCluster, error)

GetMiddlewareClusters gets the mysql clusters of this resource group

func (*ResourceGroupInfo) GetMiddlewareServers added in v1.1.1

func (rgi *ResourceGroupInfo) GetMiddlewareServers() ([]metadata.MiddlewareServer, error)

GetMiddlewareServers gets the mysql servers of this resource group

func (*ResourceGroupInfo) GetMySQLClusters added in v1.1.1

func (rgi *ResourceGroupInfo) GetMySQLClusters() ([]metadata.MySQLCluster, error)

GetMySQLClusters gets the mysql clusters of this resource group

func (*ResourceGroupInfo) GetMySQLServers added in v1.1.1

func (rgi *ResourceGroupInfo) GetMySQLServers() ([]metadata.MySQLServer, error)

GetMySQLServers gets the mysql servers of this resource group

func (*ResourceGroupInfo) GetResourceGroupRepo added in v1.1.1

func (rgi *ResourceGroupInfo) GetResourceGroupRepo() metadata.ResourceGroupRepo

GetResourceGroupRepo returns the ResourceGroupRepo

func (*ResourceGroupInfo) GetResourceRoles added in v1.1.1

func (rgi *ResourceGroupInfo) GetResourceRoles() ([]metadata.ResourceRole, error)

GetResourceRoles get all resource roles of this resource group

func (*ResourceGroupInfo) GetUsers added in v1.1.1

func (rgi *ResourceGroupInfo) GetUsers() ([]metadata.User, error)

GetUsers gets the users of this resource group

func (*ResourceGroupInfo) Identity added in v1.1.1

func (rgi *ResourceGroupInfo) Identity() int

Identity returns the Identity

func (*ResourceGroupInfo) MarshalJSON added in v1.1.1

func (rgi *ResourceGroupInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals ResourceGroup to json string

func (*ResourceGroupInfo) MarshalJSONWithFields added in v1.1.1

func (rgi *ResourceGroupInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only specified field of the ResourceGroup to json string

func (*ResourceGroupInfo) Set added in v1.1.1

func (rgi *ResourceGroupInfo) Set(fields map[string]interface{}) error

Set sets the resource group with given fields, key is the field name and value is the relevant value of the key

type ResourceGroupRepo added in v1.1.1

type ResourceGroupRepo struct {
	Database middleware.Pool
}

func (*ResourceGroupRepo) AddMiddlewareCluster added in v1.1.1

func (rgr *ResourceGroupRepo) AddMiddlewareCluster(resourceGroupID int, middlewareClusterID int) error

AddMiddlewareCluster adds middleware cluster to the resource group

func (*ResourceGroupRepo) AddMySQLCluster added in v1.1.1

func (rgr *ResourceGroupRepo) AddMySQLCluster(resourceGroupID int, mysqlClusterID int) error

AddMySQLCluster adds mysql cluster to the resource group

func (*ResourceGroupRepo) AddResourceRole added in v1.1.1

func (rgr *ResourceGroupRepo) AddResourceRole(resourceGroupID int, resourceRoleID int) error

AddResourceRole adds resource role to the resource group

func (*ResourceGroupRepo) Create added in v1.1.1

Create creates data with given entity in the middleware

func (*ResourceGroupRepo) Delete added in v1.1.1

func (rgr *ResourceGroupRepo) Delete(id int) error

Delete deletes data in the middleware, it will also delete concerning map data

func (*ResourceGroupRepo) DeleteMiddlewareCluster added in v1.1.1

func (rgr *ResourceGroupRepo) DeleteMiddlewareCluster(resourceGroupID, middlewareClusterID int) error

DeleteMiddlewareCluster deletes middleware cluster from the resource group

func (*ResourceGroupRepo) DeleteMySQLCluster added in v1.1.1

func (rgr *ResourceGroupRepo) DeleteMySQLCluster(resourceGroupID, mysqlClusterID int) error

DeleteMySQLCluster deletes mysql cluster from the resource group

func (*ResourceGroupRepo) DeleteResourceRole added in v1.1.1

func (rgr *ResourceGroupRepo) DeleteResourceRole(resourceGroupID, resourceRoleID int) error

DeleteResourceRole deletes resource role from the resource group

func (*ResourceGroupRepo) Execute added in v1.1.1

func (rgr *ResourceGroupRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute implements metadata.ResourceGroupRepo interface, it executes command with arguments on database

func (*ResourceGroupRepo) GetAll added in v1.1.1

func (rgr *ResourceGroupRepo) GetAll() ([]metadata.ResourceGroup, error)

GetAll returns all available entities

func (*ResourceGroupRepo) GetByGroupUUID added in v1.1.1

func (rgr *ResourceGroupRepo) GetByGroupUUID(groupUUID string) (metadata.ResourceGroup, error)

GetByGroupUUID gets the resource group with given resource group id from the middleware

func (*ResourceGroupRepo) GetByID added in v1.1.1

func (rgr *ResourceGroupRepo) GetByID(id int) (metadata.ResourceGroup, error)

GetByID Select returns an available entity of the given id

func (*ResourceGroupRepo) GetDASAdminUsersByID added in v1.1.1

func (rgr *ResourceGroupRepo) GetDASAdminUsersByID(id int) ([]metadata.User, error)

GetDASAdminUsersByID gets the users of the given id from the middleware

func (*ResourceGroupRepo) GetID added in v1.1.1

func (rgr *ResourceGroupRepo) GetID(groupUUID string) (int, error)

GetID gets the identity with given resource group id from the middleware

func (*ResourceGroupRepo) GetMiddlewareClustersByID added in v1.1.1

func (rgr *ResourceGroupRepo) GetMiddlewareClustersByID(id int) ([]metadata.MiddlewareCluster, error)

GetMiddlewareClustersByID gets the middleware cluster with given resource group id from the middleware

func (*ResourceGroupRepo) GetMiddlewareServersByID added in v1.1.1

func (rgr *ResourceGroupRepo) GetMiddlewareServersByID(id int) ([]metadata.MiddlewareServer, error)

GetMiddlewareServersByID gets the middleware servers with given resource group uuid from the middleware

func (*ResourceGroupRepo) GetMySQLClustersByID added in v1.1.1

func (rgr *ResourceGroupRepo) GetMySQLClustersByID(id int) ([]metadata.MySQLCluster, error)

GetMySQLClustersByID gets the mysql cluster with given resource group id from the middleware

func (*ResourceGroupRepo) GetMySQLServersByID added in v1.1.1

func (rgr *ResourceGroupRepo) GetMySQLServersByID(id int) ([]metadata.MySQLServer, error)

GetMySQLServersByID gets the mysql servers with given resource group uuid from the middleware

func (*ResourceGroupRepo) GetResourceRolesByID added in v1.1.1

func (rgr *ResourceGroupRepo) GetResourceRolesByID(id int) ([]metadata.ResourceRole, error)

GetResourceRolesByID get all resource roles with given resource group id from the middleware

func (*ResourceGroupRepo) GetUsersByID added in v1.1.1

func (rgr *ResourceGroupRepo) GetUsersByID(id int) ([]metadata.User, error)

GetUsersByID gets the users of the given id from the middleware

func (*ResourceGroupRepo) Transaction added in v1.1.1

func (rgr *ResourceGroupRepo) Transaction() (middleware.Transaction, error)

Transaction returns middleware.PoolConn

func (*ResourceGroupRepo) Update added in v1.1.1

Update updates data with given entity in the middleware

type ResourceGroupService added in v1.1.1

type ResourceGroupService struct {
	ResourceGroupRepo  metadata.ResourceGroupRepo
	ResourceGroups     []metadata.ResourceGroup     `json:"resource_groups"`
	ResourceRoles      []metadata.ResourceRole      `json:"resource_roles"`
	MySQLClusters      []metadata.MySQLCluster      `json:"mysql_clusters"`
	MySQLServers       []metadata.MySQLServer       `json:"mysql_servers"`
	MiddlewareClusters []metadata.MiddlewareCluster `json:"middleware_clusters"`
	MiddlewareServers  []metadata.MiddlewareServer  `json:"middleware_servers"`
	Users              []metadata.User              `json:"users"`
}

func (*ResourceGroupService) AddMiddlewareCluster added in v1.1.1

func (rgs *ResourceGroupService) AddMiddlewareCluster(resourceGroupID int, middlewareClusterID int) error

AddMiddlewareCluster adds middleware cluster to the resource group

func (*ResourceGroupService) AddMySQLCluster added in v1.1.1

func (rgs *ResourceGroupService) AddMySQLCluster(resourceGroupID int, mysqlClusterID int) error

AddMySQLCluster adds mysql cluster to the resource group

func (*ResourceGroupService) AddResourceRole added in v1.1.1

func (rgs *ResourceGroupService) AddResourceRole(resourceGroupID int, resourceRoleID int) error

AddResourceRole adds resource role to the resource group

func (*ResourceGroupService) Create added in v1.1.1

func (rgs *ResourceGroupService) Create(fields map[string]interface{}) error

Create creates a mysql server in the mysql

func (*ResourceGroupService) Delete added in v1.1.1

func (rgs *ResourceGroupService) Delete(id int) error

Delete deletes the mysql server of given id

func (*ResourceGroupService) DeleteMiddlewareCluster added in v1.1.1

func (rgs *ResourceGroupService) DeleteMiddlewareCluster(resourceGroupID int, middlewareClusterID int) error

DeleteMiddlewareCluster deletes middleware cluster from the resource group

func (*ResourceGroupService) DeleteMySQLCluster added in v1.1.1

func (rgs *ResourceGroupService) DeleteMySQLCluster(resourceGroupID int, mysqlClusterID int) error

DeleteMySQLCluster deletes mysql cluster from the resource group

func (*ResourceGroupService) DeleteResourceRole added in v1.1.1

func (rgs *ResourceGroupService) DeleteResourceRole(resourceGroupID int, resourceRoleID int) error

DeleteResourceRole deletes resource role from the resource group

func (*ResourceGroupService) GetAll added in v1.1.1

func (rgs *ResourceGroupService) GetAll() error

GetAll gets all mysql servers from the mysql

func (*ResourceGroupService) GetByGroupUUID added in v1.1.1

func (rgs *ResourceGroupService) GetByGroupUUID(groupUUID string) error

GetByGroupUUID gets the resource group by group uuid

func (*ResourceGroupService) GetByID added in v1.1.1

func (rgs *ResourceGroupService) GetByID(id int) error

GetByID gets the resource group of the given id

func (*ResourceGroupService) GetDASAdminUsersByGroupUUID added in v1.1.1

func (rgs *ResourceGroupService) GetDASAdminUsersByGroupUUID(groupUUID string) error

GetDASAdminUsersByGroupUUID gets the das admin users with given resource group uuid

func (*ResourceGroupService) GetDASAdminUsersByID added in v1.1.1

func (rgs *ResourceGroupService) GetDASAdminUsersByID(id int) error

GetDASAdminUsersByID gets the das admin users with given resource group id

func (*ResourceGroupService) GetMiddlewareClusters added in v1.1.1

func (rgs *ResourceGroupService) GetMiddlewareClusters() []metadata.MiddlewareCluster

GetMiddlewareClusters returns the middleware clusters of the service

func (*ResourceGroupService) GetMiddlewareClustersByGroupUUID added in v1.1.1

func (rgs *ResourceGroupService) GetMiddlewareClustersByGroupUUID(groupUUID string) error

GetMiddlewareClustersByGroupUUID gets the middleware clusters with given resource group uuid

func (*ResourceGroupService) GetMiddlewareClustersByID added in v1.1.1

func (rgs *ResourceGroupService) GetMiddlewareClustersByID(id int) error

GetMiddlewareClustersByID gets the middleware clusters with given resource group id

func (*ResourceGroupService) GetMiddlewareServers added in v1.1.1

func (rgs *ResourceGroupService) GetMiddlewareServers() []metadata.MiddlewareServer

GetMiddlewareServers returns the middleware servers of the service

func (*ResourceGroupService) GetMiddlewareServersByGroupUUID added in v1.1.1

func (rgs *ResourceGroupService) GetMiddlewareServersByGroupUUID(groupUUID string) error

GetMiddlewareServersByGroupUUID gets the middleware servers with given resource group uuid

func (*ResourceGroupService) GetMiddlewareServersByID added in v1.1.1

func (rgs *ResourceGroupService) GetMiddlewareServersByID(id int) error

GetMiddlewareServersByID gets the middleware servers with given resource group id

func (*ResourceGroupService) GetMySQLClusters added in v1.1.1

func (rgs *ResourceGroupService) GetMySQLClusters() []metadata.MySQLCluster

GetMySQLClusters returns the mysql clusters of the service

func (*ResourceGroupService) GetMySQLClustersByGroupUUID added in v1.1.1

func (rgs *ResourceGroupService) GetMySQLClustersByGroupUUID(groupUUID string) error

GetMySQLClustersByGroupUUID gets the mysql clusters with given resource group uuid

func (*ResourceGroupService) GetMySQLClustersByID added in v1.1.1

func (rgs *ResourceGroupService) GetMySQLClustersByID(id int) error

GetMySQLClustersByID gets the mysql clusters with given resource group id

func (*ResourceGroupService) GetMySQLServers added in v1.1.1

func (rgs *ResourceGroupService) GetMySQLServers() []metadata.MySQLServer

GetMySQLServers returns the mysql servers of the service

func (*ResourceGroupService) GetMySQLServersByGroupUUID added in v1.1.1

func (rgs *ResourceGroupService) GetMySQLServersByGroupUUID(groupUUID string) error

GetMySQLServersByGroupUUID gets the mysql servers with given resource group uuid

func (*ResourceGroupService) GetMySQLServersByID added in v1.1.1

func (rgs *ResourceGroupService) GetMySQLServersByID(id int) error

GetMySQLServersByID gets the mysql servers with given resource group id

func (*ResourceGroupService) GetResourceGroups added in v1.1.1

func (rgs *ResourceGroupService) GetResourceGroups() []metadata.ResourceGroup

GetResourceGroups returns resource groups of the service

func (*ResourceGroupService) GetResourceRoles added in v1.1.1

func (rgs *ResourceGroupService) GetResourceRoles() []metadata.ResourceRole

GetResourceRoles returns the resource roles of the service

func (*ResourceGroupService) GetResourceRolesByGroupUUID added in v1.1.1

func (rgs *ResourceGroupService) GetResourceRolesByGroupUUID(groupUUID string) error

GetResourceRolesByGroupUUID get all resource roles with given resource group uuid

func (*ResourceGroupService) GetResourceRolesByID added in v1.1.1

func (rgs *ResourceGroupService) GetResourceRolesByID(id int) error

GetResourceRolesByID get all resource roles with given resource group id

func (*ResourceGroupService) GetUsers added in v1.1.1

func (rgs *ResourceGroupService) GetUsers() []metadata.User

GetUsers returns the users of the service

func (*ResourceGroupService) GetUsersByGroupUUID added in v1.1.1

func (rgs *ResourceGroupService) GetUsersByGroupUUID(groupUUID string) error

GetUsersByGroupUUID gets the users with given resource group uuid

func (*ResourceGroupService) GetUsersByID added in v1.1.1

func (rgs *ResourceGroupService) GetUsersByID(id int) error

GetUsersByID gets the users with given resource group id

func (*ResourceGroupService) Marshal added in v1.1.1

func (rgs *ResourceGroupService) Marshal() ([]byte, error)

Marshal marshals ResourceGroupService.ResourceGroups to json bytes

func (*ResourceGroupService) MarshalWithFields added in v1.1.1

func (rgs *ResourceGroupService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals only specified fields of the ResourceGroupService to json bytes

func (*ResourceGroupService) Update added in v1.1.1

func (rgs *ResourceGroupService) Update(id int, fields map[string]interface{}) error

Update gets a mysql server of the given id from the mysql, and then updates its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the mysql

type ResourceRoleInfo added in v1.1.1

type ResourceRoleInfo struct {
	ResourceRoleRepo metadata.ResourceRoleRepo
	ID               int       `middleware:"id" json:"id"`
	RoleUUID         string    `middleware:"role_uuid" json:"role_uuid"`
	RoleName         string    `middleware:"role_name" json:"role_name"`
	DelFlag          int       `middleware:"del_flag" json:"del_flag"`
	CreateTime       time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime   time.Time `middleware:"last_update_time" json:"last_update_time"`
}

ResourceRoleInfo is the entity interface

func (*ResourceRoleInfo) AddResourceGroup added in v1.1.1

func (rri *ResourceRoleInfo) AddResourceGroup(resourceGroupID int) error

AddResourceGroup adds a map of resource role and resource group

func (*ResourceRoleInfo) AddUser added in v1.1.1

func (rri *ResourceRoleInfo) AddUser(userID int) error

AddUser adds a map of the resource role and user

func (*ResourceRoleInfo) Delete added in v1.1.1

func (rri *ResourceRoleInfo) Delete()

Delete sets DelFlag to 1

func (*ResourceRoleInfo) DeleteResourceGroup added in v1.1.1

func (rri *ResourceRoleInfo) DeleteResourceGroup(resourceGroupID int) error

DeleteResourceGroup deletes the map of resource role and resource

func (*ResourceRoleInfo) DeleteUser added in v1.1.1

func (rri *ResourceRoleInfo) DeleteUser(userID int) error

DeleteUser deletes the map of the resource role and user

func (*ResourceRoleInfo) GetCreateTime added in v1.1.1

func (rri *ResourceRoleInfo) GetCreateTime() time.Time

GetCreateTime returns created time

func (*ResourceRoleInfo) GetDelFlag added in v1.1.1

func (rri *ResourceRoleInfo) GetDelFlag() int

GetDelFlag returns the delete flag

func (*ResourceRoleInfo) GetLastUpdateTime added in v1.1.1

func (rri *ResourceRoleInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns last updated time

func (*ResourceRoleInfo) GetResourceGroups added in v1.1.1

func (rri *ResourceRoleInfo) GetResourceGroups() ([]metadata.ResourceGroup, error)

GetResourceGroups gets the resource group which this role belongs to

func (*ResourceRoleInfo) GetRoleName added in v1.1.1

func (rri *ResourceRoleInfo) GetRoleName() string

GetRoleName returns the role name

func (*ResourceRoleInfo) GetRoleUUID added in v1.1.1

func (rri *ResourceRoleInfo) GetRoleUUID() string

GetRoleUUID returns the role uuid

func (*ResourceRoleInfo) GetUsers added in v1.1.1

func (rri *ResourceRoleInfo) GetUsers() ([]metadata.User, error)

GetUsers gets the users of this resource role

func (*ResourceRoleInfo) Identity added in v1.1.1

func (rri *ResourceRoleInfo) Identity() int

Identity cluster returns ID of mysql cluster

func (*ResourceRoleInfo) MarshalJSON added in v1.1.1

func (rri *ResourceRoleInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals ResourceRole to json string

func (*ResourceRoleInfo) MarshalJSONWithFields added in v1.1.1

func (rri *ResourceRoleInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only specified field of the ResourceRole to json string

func (*ResourceRoleInfo) Set added in v1.1.1

func (rri *ResourceRoleInfo) Set(fields map[string]interface{}) error

Set sets the resource group with given fields, key is the field name and value is the relevant value of the key

type ResourceRoleRepo added in v1.1.1

type ResourceRoleRepo struct {
	Database middleware.Pool
}

ResourceRoleRepo implements dependency.ResourceRoleRepo interface

func (*ResourceRoleRepo) AddResourceGroup added in v1.1.1

func (rrr *ResourceRoleRepo) AddResourceGroup(resourceRoleID int, resourceGroupID int) error

AddResourceGroup adds a map of resource role and resource group in the middleware

func (*ResourceRoleRepo) AddUser added in v1.1.1

func (rrr *ResourceRoleRepo) AddUser(resourceRoleID int, userID int) error

AddUser adds a map of the resource role and user from the middleware

func (*ResourceRoleRepo) Create added in v1.1.1

func (rrr *ResourceRoleRepo) Create(resourceRole metadata.ResourceRole) (metadata.ResourceRole, error)

Create creates data with given entity in the middleware

func (*ResourceRoleRepo) Delete added in v1.1.1

func (rrr *ResourceRoleRepo) Delete(id int) error

Delete deletes data in the middleware, it is recommended to use soft deletion, therefore use update instead of delete

func (*ResourceRoleRepo) DeleteResourceGroup added in v1.1.1

func (rrr *ResourceRoleRepo) DeleteResourceGroup(resourceRoleID int, resourceGroupID int) error

DeleteResourceGroup deletes the map of resource role and resource group from the middleware

func (*ResourceRoleRepo) DeleteUser added in v1.1.1

func (rrr *ResourceRoleRepo) DeleteUser(resourceRoleID int, userID int) error

DeleteUser deletes the map of the resource role and user from the middleware

func (*ResourceRoleRepo) Execute added in v1.1.1

func (rrr *ResourceRoleRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute executes given command and placeholders on the middleware it executes command with arguments on database

func (*ResourceRoleRepo) GetAll added in v1.1.1

func (rrr *ResourceRoleRepo) GetAll() ([]metadata.ResourceRole, error)

GetAll gets all resource groups from the middleware

func (*ResourceRoleRepo) GetByID added in v1.1.1

func (rrr *ResourceRoleRepo) GetByID(id int) (metadata.ResourceRole, error)

GetByID gets the resource role by the identity from the middleware

func (*ResourceRoleRepo) GetByRoleUUID added in v1.1.1

func (rrr *ResourceRoleRepo) GetByRoleUUID(roleUUID string) (metadata.ResourceRole, error)

GetByRoleUUID gets the resource role with given resource role id from the middleware

func (*ResourceRoleRepo) GetID added in v1.1.1

func (rrr *ResourceRoleRepo) GetID(roleUUID string) (int, error)

GetID gets the identity with given resource role id from the middleware

func (*ResourceRoleRepo) GetResourceGroupsByID added in v1.1.1

func (rrr *ResourceRoleRepo) GetResourceGroupsByID(id int) ([]metadata.ResourceGroup, error)

GetResourceGroupsByID gets the resource group which this role belongs to with given resource role id from the middleware

func (*ResourceRoleRepo) GetUsersByID added in v1.1.1

func (rrr *ResourceRoleRepo) GetUsersByID(id int) ([]metadata.User, error)

GetUsersByID gets the users of the given id from the middleware

func (*ResourceRoleRepo) Transaction added in v1.1.1

func (rrr *ResourceRoleRepo) Transaction() (middleware.Transaction, error)

Transaction returns a mysql.Transaction that could execute multiple commands as a transaction

func (*ResourceRoleRepo) Update added in v1.1.1

func (rrr *ResourceRoleRepo) Update(entity metadata.ResourceRole) error

Update updates data with given entity in the middleware

type ResourceRoleService added in v1.1.1

type ResourceRoleService struct {
	ResourceRoleRepo metadata.ResourceRoleRepo
	ResourceRoles    []metadata.ResourceRole  `json:"resource_roles"`
	ResourceGroups   []metadata.ResourceGroup `json:"resource_groups"`
	Users            []metadata.User          `json:"users"`
}

ResourceRoleService implements Service interface

func (*ResourceRoleService) AddResourceGroup added in v1.1.1

func (rrs *ResourceRoleService) AddResourceGroup(resourceRoleID int, resourceGroupID int) error

AddResourceGroup adds a map of resource role and resource group in the middleware

func (*ResourceRoleService) AddUser added in v1.1.1

func (rrs *ResourceRoleService) AddUser(resourceRoleID, userID int) error

AddUser adds a map of the resource role and user

func (*ResourceRoleService) Create added in v1.1.1

func (rrs *ResourceRoleService) Create(fields map[string]interface{}) error

Create creates a resource role in resource group

func (*ResourceRoleService) Delete added in v1.1.1

func (rrs *ResourceRoleService) Delete(id int) error

Delete deletes the resource role of given id

func (*ResourceRoleService) DeleteResourceGroup added in v1.1.1

func (rrs *ResourceRoleService) DeleteResourceGroup(resourceRoleID int, resourceGroupID int) error

DeleteResourceGroup deletes the map of resource role and resource group from the middleware

func (*ResourceRoleService) DeleteUser added in v1.1.1

func (rrs *ResourceRoleService) DeleteUser(resourceRoleID, userID int) error

DeleteUser deletes the map of the resource role and user

func (*ResourceRoleService) GetAll added in v1.1.1

func (rrs *ResourceRoleService) GetAll() error

GetAll gets all resource roles

func (*ResourceRoleService) GetByID added in v1.1.1

func (rrs *ResourceRoleService) GetByID(id int) error

GetByID gets the resource role of the given id

func (*ResourceRoleService) GetByRoleUUID added in v1.1.1

func (rrs *ResourceRoleService) GetByRoleUUID(groupUUID string) error

GetByRoleUUID gets the resource role by role uuid

func (*ResourceRoleService) GetResourceGroups added in v1.1.1

func (rrs *ResourceRoleService) GetResourceGroups() []metadata.ResourceGroup

GetResourceGroups returns the resource group of the service

func (*ResourceRoleService) GetResourceGroupsByID added in v1.1.1

func (rrs *ResourceRoleService) GetResourceGroupsByID(id int) error

GetResourceGroupsByID gets the resource group with given resource role id

func (*ResourceRoleService) GetResourceRoles added in v1.1.1

func (rrs *ResourceRoleService) GetResourceRoles() []metadata.ResourceRole

GetResourceRoles returns the resource roles of the service

func (*ResourceRoleService) GetUsers added in v1.1.1

func (rrs *ResourceRoleService) GetUsers() []metadata.User

GetUsers returns the users of the service

func (*ResourceRoleService) GetUsersByID added in v1.1.1

func (rrs *ResourceRoleService) GetUsersByID(id int) error

GetUsersByID gets the users with given resource role id

func (*ResourceRoleService) GetUsersByRoleUUID added in v1.1.1

func (rrs *ResourceRoleService) GetUsersByRoleUUID(roleUUID string) error

GetUsersByRoleUUID gets the users with given resource role uuid

func (*ResourceRoleService) Marshal added in v1.1.1

func (rrs *ResourceRoleService) Marshal() ([]byte, error)

Marshal marshals ResourceRoleService.ResourceRoles to json bytes

func (*ResourceRoleService) MarshalWithFields added in v1.1.1

func (rrs *ResourceRoleService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals only specified fields of the ResourceRoleService to json bytes

func (*ResourceRoleService) Update added in v1.1.1

func (rrs *ResourceRoleService) Update(id int, fields map[string]interface{}) error

Update gets a resource role of the given id from the middleware, and then updates its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

type TableInfo added in v1.1.1

type TableInfo struct {
	TableRepo metadata.TableRepo
	DBName    string `middleware:"db_name" json:"db_name"`
	TableName string `middleware:"table_name" json:"table_name"`
}

TableInfo include information of logic table

func NewEmptyTableInfo added in v1.1.1

func NewEmptyTableInfo() *TableInfo

NewEmptyTableInfo return *TableInfo

func NewTableInfo added in v1.1.1

func NewTableInfo(repo metadata.TableRepo, dbName string, tableName string) *TableInfo

NewTableInfo returns a new TableInfo

func NewTableInfoWithMapAndRandom added in v1.1.1

func NewTableInfoWithMapAndRandom(fields map[string]interface{}) (*TableInfo, error)

NewTableInfoWithMapAndRandom returns a new *TableInfo with given map

func (*TableInfo) GetCreateStatement added in v1.1.1

func (ti *TableInfo) GetCreateStatement() (string, error)

GetCreateStatement returns the create statement

func (*TableInfo) GetDBName added in v1.1.1

func (ti *TableInfo) GetDBName() string

GetDBName returns the table schema

func (*TableInfo) GetIndexStatistics added in v1.1.1

func (ti *TableInfo) GetIndexStatistics() ([]metadata.IndexStatistic, error)

GetIndexStatistics returns the index statistics

func (*TableInfo) GetTableName added in v1.1.1

func (ti *TableInfo) GetTableName() string

GetTableName returns the table name

func (*TableInfo) GetTableStatistics added in v1.1.1

func (ti *TableInfo) GetTableStatistics() ([]metadata.TableStatistic, error)

GetTableStatistics returns the table statistics

func (*TableInfo) MarshalJSON added in v1.1.1

func (ti *TableInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals Table to json string

func (*TableInfo) MarshalJSONWithFields added in v1.1.1

func (ti *TableInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only specified field of the Table to json string

type TableRepo added in v1.1.1

type TableRepo struct {
	Conn *mysql.Conn
}

TableRepo implements dependency.TableRepo interface

func (*TableRepo) AnalyzeTableByDBNameAndTableName added in v1.1.1

func (tr *TableRepo) AnalyzeTableByDBNameAndTableName(dbName, tableName string) error

AnalyzeTableByDBNameAndTableName analyzes the table by DB name and table name

func (*TableRepo) Close added in v1.1.1

func (tr *TableRepo) Close() error

Close closes the mysql connection

func (*TableRepo) Execute added in v1.1.1

func (tr *TableRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute implements dependency.MySQLServerRepo interface, it executes command with arguments on database

func (*TableRepo) GetByDBName added in v1.1.1

func (tr *TableRepo) GetByDBName(dbName string) ([]metadata.Table, error)

GetByDBName gets the table info by db name from middleware

func (*TableRepo) GetCreateStatement added in v1.1.1

func (tr *TableRepo) GetCreateStatement(dbName, tableName string) (string, error)

GetCreateStatement gets the create statement of the table

func (*TableRepo) GetIndexStatistics added in v1.1.1

func (tr *TableRepo) GetIndexStatistics(dbName, tableName string) ([]metadata.IndexStatistic, error)

GetIndexStatistics gets index statistics from the middleware

func (*TableRepo) GetStatisticsByDBNameAndTableName added in v1.1.1

func (tr *TableRepo) GetStatisticsByDBNameAndTableName(dbName string, tableName string) ([]metadata.TableStatistic, []metadata.IndexStatistic, string, error)

GetStatisticsByDBNameAndTableName gets the full table info by db name and table name from middleware

func (*TableRepo) GetTableStatistics added in v1.1.1

func (tr *TableRepo) GetTableStatistics(dbName, tableName string) ([]metadata.TableStatistic, error)

GetTableStatistics gets table statistics from the middleware

func (*TableRepo) InitMySQLConn added in v1.1.1

func (tr *TableRepo) InitMySQLConn(hostIP string, portNum int, dbName string) error

InitMySQLConn initialize the mysql connection of the repository

type TableService added in v1.1.1

type TableService struct {
	metadata.TableRepo
	Tables          []metadata.Table          `middleware:"tables" json:"tables"`
	TableStatistics []metadata.TableStatistic `middleware:"table_statistics" json:"table_statistics"`
	IndexStatistics []metadata.IndexStatistic `middleware:"index_statistics" json:"index_statistics"`
	CreateStatement string                    `middleware:"create_statement" json:"create_statement"`
}

TableService implements dependency.TableService

func (*TableService) AnalyzeTableByDBIDAndTableName added in v1.1.1

func (ts *TableService) AnalyzeTableByDBIDAndTableName(dbID int, tableName string) error

AnalyzeTableByDBIDAndTableName analyzes the table by db id and table name

func (*TableService) AnalyzeTableByHostInfoAndDBNameAndTableName added in v1.1.1

func (ts *TableService) AnalyzeTableByHostInfoAndDBNameAndTableName(hostIP string, portNum int, dbName, tableName string) error

AnalyzeTableByHostInfoAndDBNameAndTableName analyzes the table by host info and db name and table name

func (*TableService) GetByDBID added in v1.1.1

func (ts *TableService) GetByDBID(dbID int) error

GetByDBID return table service by db id

func (*TableService) GetCreateStatement added in v1.1.1

func (ts *TableService) GetCreateStatement() string

GetCreateStatement returns the create statement of table

func (*TableService) GetIndexStatistics added in v1.1.1

func (ts *TableService) GetIndexStatistics() []metadata.IndexStatistic

GetIndexStatistics returns the index statistics list

func (*TableService) GetStatisticsByDBIDAndTableName added in v1.1.1

func (ts *TableService) GetStatisticsByDBIDAndTableName(dbID int, tableName string) error

GetStatisticsByDBIDAndTableName gets the table statistics by db id and table name

func (*TableService) GetStatisticsByHostInfoAndDBNameAndTableName added in v1.1.1

func (ts *TableService) GetStatisticsByHostInfoAndDBNameAndTableName(hostIP string, portNum int, dbName, tableName string) error

GetStatisticsByHostInfoAndDBNameAndTableName gets the table statistics by host info and db name and table name

func (*TableService) GetTableStatistics added in v1.1.1

func (ts *TableService) GetTableStatistics() []metadata.TableStatistic

GetTableStatistics returns the table statistics list

func (*TableService) GetTables added in v1.1.1

func (ts *TableService) GetTables() []metadata.Table

GetTables returns the tables list

func (*TableService) Marshal added in v1.1.1

func (ts *TableService) Marshal() ([]byte, error)

Marshal marshals TableService.Tables to json bytes

func (*TableService) MarshalWithFields added in v1.1.1

func (ts *TableService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals only specified fields of the TableService to json bytes

type TableStatistic added in v1.1.1

type TableStatistic struct {
	DBName        string    `middleware:"db_name" json:"db_name"`
	TableName     string    `middleware:"table_name" json:"table_name"`
	Rows          int       `middleware:"table_rows" json:"table_rows"`
	Size          int       `middleware:"size" json:"size"`
	SizeMB        float64   `middleware:"size_mb" json:"size_mb"`
	AvgRowLength  int       `middleware:"avg_row_length" json:"avg_row_length"`
	AutoIncrement int       `middleware:"auto_increment" json:"auto_increment"`
	Engine        string    `middleware:"engine" json:"engine"`
	CharSet       string    `middleware:"char_set" json:"char_set"`
	Collation     string    `middleware:"collation" json:"collation"`
	CreateTime    time.Time `middleware:"create_time" json:"create_time"`
}

TableStatistic include statistics of table

func NewEmptyTableStatistic added in v1.1.1

func NewEmptyTableStatistic() *TableStatistic

NewEmptyTableStatistic returns an empty *TableStatistic

func (*TableStatistic) GetAutoIncrement added in v1.1.1

func (ts *TableStatistic) GetAutoIncrement() int

GetAutoIncrement returns the state of auto increment

func (*TableStatistic) GetAvgRowLength added in v1.1.1

func (ts *TableStatistic) GetAvgRowLength() int

GetAvgRowLength returns the average row length of the table

func (*TableStatistic) GetCharSet added in v1.1.1

func (ts *TableStatistic) GetCharSet() string

GetCharSet returns the charset of the table

func (*TableStatistic) GetCollation added in v1.1.1

func (ts *TableStatistic) GetCollation() string

GetCollation returns the collation of the table

func (*TableStatistic) GetCreateTime added in v1.1.1

func (ts *TableStatistic) GetCreateTime() time.Time

GetCreateTime returns the create time of the table

func (*TableStatistic) GetDBName added in v1.1.1

func (ts *TableStatistic) GetDBName() string

GetDBName returns the table schema

func (*TableStatistic) GetEngine added in v1.1.1

func (ts *TableStatistic) GetEngine() string

GetEngine returns the engine type of the table

func (*TableStatistic) GetSize added in v1.1.1

func (ts *TableStatistic) GetSize() int

GetSize returns the size of the table

func (*TableStatistic) GetSizeMB added in v1.1.1

func (ts *TableStatistic) GetSizeMB() float64

GetSizeMB returns the size(MB) of the table

func (*TableStatistic) GetTableName added in v1.1.1

func (ts *TableStatistic) GetTableName() string

GetTableName returns the table name

func (*TableStatistic) GetTableRows added in v1.1.1

func (ts *TableStatistic) GetTableRows() int

GetTableRows returns the rows of the table

func (*TableStatistic) MarshalJSON added in v1.1.1

func (ts *TableStatistic) MarshalJSON() ([]byte, error)

MarshalJSON marshals Table to json string

type UserInfo

type UserInfo struct {
	metadata.UserRepo
	ID             int       `middleware:"id" json:"id"`
	UserName       string    `middleware:"user_name" json:"user_name"`
	DepartmentName string    `middleware:"department_name" json:"department_name"`
	EmployeeID     string    `middleware:"employee_id" json:"employee_id"`
	AccountName    string    `middleware:"account_name" json:"account_name"`
	Email          string    `middleware:"email" json:"email"`
	Telephone      string    `middleware:"telephone" json:"telephone"`
	Mobile         string    `middleware:"mobile" json:"mobile"`
	Role           int       `middleware:"role" json:"role"`
	DelFlag        int       `middleware:"del_flag" json:"del_flag"`
	CreateTime     time.Time `middleware:"create_time" json:"create_time"`
	LastUpdateTime time.Time `middleware:"last_update_time" json:"last_update_time"`
}

UserInfo create userinfo struct

func (*UserInfo) Delete

func (ui *UserInfo) Delete()

Delete sets DelFlag to 1

func (*UserInfo) GetAccountName

func (ui *UserInfo) GetAccountName() string

GetAccountName returns the account name

func (*UserInfo) GetAllMySQLServers added in v1.1.1

func (ui *UserInfo) GetAllMySQLServers() ([]metadata.MySQLServer, error)

GetAllMySQLServers gets all mysql servers of this user from the middleware

func (*UserInfo) GetCreateTime

func (ui *UserInfo) GetCreateTime() time.Time

GetCreateTime returns the create time

func (*UserInfo) GetDelFlag

func (ui *UserInfo) GetDelFlag() int

GetDelFlag returns the delete flag

func (*UserInfo) GetDepartmentName

func (ui *UserInfo) GetDepartmentName() string

GetDepartmentName returns the department name

func (*UserInfo) GetEmail

func (ui *UserInfo) GetEmail() string

GetEmail returns the email

func (*UserInfo) GetEmployeeID

func (ui *UserInfo) GetEmployeeID() string

GetEmployeeID returns the employee id

func (*UserInfo) GetLastUpdateTime

func (ui *UserInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns the last update time

func (*UserInfo) GetMobile

func (ui *UserInfo) GetMobile() string

GetMobile returns the mobile

func (*UserInfo) GetRole

func (ui *UserInfo) GetRole() int

GetRole returns the role

func (*UserInfo) GetTelephone

func (ui *UserInfo) GetTelephone() string

GetEmail returns the telephone

func (*UserInfo) GetUserName

func (ui *UserInfo) GetUserName() string

GetUserName returns the user name

func (*UserInfo) Identity

func (ui *UserInfo) Identity() int

Identity returns the identity

func (*UserInfo) MarshalJSON

func (ui *UserInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals User to json string

func (*UserInfo) MarshalJSONWithFields

func (ui *UserInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only specified field of the User to json string

func (*UserInfo) Set

func (ui *UserInfo) Set(fields map[string]interface{}) error

Set sets entity with given fields, key is the field name and value is the relevant value of the key

type UserRepo

type UserRepo struct {
	Database middleware.Pool
}

UserRepo struct

func (*UserRepo) Create

func (ur *UserRepo) Create(user metadata.User) (metadata.User, error)

Create creates a user in the middleware

func (*UserRepo) Delete

func (ur *UserRepo) Delete(id int) error

Delete deletes the user of given id in the middleware

func (*UserRepo) Execute

func (ur *UserRepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute implements dependency.UserRepo interface, it executes command with arguments on database Execute executes given command and placeholders on the middleware

func (*UserRepo) GetAll

func (ur *UserRepo) GetAll() ([]metadata.User, error)

GetAll gets all databases from the middleware

func (*UserRepo) GetAllMySQLServersByUserID added in v1.1.1

func (ur *UserRepo) GetAllMySQLServersByUserID(id int) ([]metadata.MySQLServer, error)

GetAllMySQLServersByUserID gets mysql server list that this user owns

func (*UserRepo) GetAppsByUserID added in v1.1.1

func (ur *UserRepo) GetAppsByUserID(userID int) ([]metadata.App, error)

GetAppsByUserID gets app list that this user owns

func (*UserRepo) GetByAccountName

func (ur *UserRepo) GetByAccountName(accountName string) (metadata.User, error)

GetByAccountName gets a user of given account name from the middleware

func (*UserRepo) GetByAccountNameOrEmployeeID added in v1.1.1

func (ur *UserRepo) GetByAccountNameOrEmployeeID(loginName string) (metadata.User, error)

GetByAccountNameOrEmployeeID gets a user of given login name from the middleware

func (*UserRepo) GetByEmail

func (ur *UserRepo) GetByEmail(email string) (metadata.User, error)

GetByEmail gets a user of given email from the middleware

func (*UserRepo) GetByEmployeeID

func (ur *UserRepo) GetByEmployeeID(employeeID string) (metadata.User, error)

GetByEmployeeID gets a user of given employee id from the middleware

func (*UserRepo) GetByID

func (ur *UserRepo) GetByID(id int) (metadata.User, error)

GetByID gets a user by the identity from the middleware

func (*UserRepo) GetByMobile

func (ur *UserRepo) GetByMobile(mobile string) (metadata.User, error)

GetByTelephone gets a user of given mobile from the middleware

func (*UserRepo) GetByTelephone

func (ur *UserRepo) GetByTelephone(telephone string) (metadata.User, error)

GetByTelephone gets a user of given telephone from the middleware

func (*UserRepo) GetByUserName added in v1.1.1

func (ur *UserRepo) GetByUserName(userName string) ([]metadata.User, error)

GetByUserName gets users of given username from the middleware

func (*UserRepo) GetDBsByUserID added in v1.1.1

func (ur *UserRepo) GetDBsByUserID(userID int) ([]metadata.DB, error)

GetDBsByUserID gets dbs that this user owns

func (*UserRepo) GetID

func (ur *UserRepo) GetID(accountName string) (int, error)

GetID gets the identity with given account name from the middleware

func (*UserRepo) GetMiddlewareClustersByUserID added in v1.1.1

func (ur *UserRepo) GetMiddlewareClustersByUserID(userID int) ([]metadata.MiddlewareCluster, error)

GetMiddlewareClustersByUserID gets middleware clusters that this user owns

func (*UserRepo) GetMySQLClustersByUserID added in v1.1.1

func (ur *UserRepo) GetMySQLClustersByUserID(userID int) ([]metadata.MySQLCluster, error)

GetMySQLClustersByUserID gets mysql clusters that this user owns

func (*UserRepo) Transaction

func (ur *UserRepo) Transaction() (middleware.Transaction, error)

Transaction returns a middleware.Transaction that could execute multiple commands as a transaction

func (*UserRepo) Update

func (ur *UserRepo) Update(user metadata.User) error

Update updates a user in the middleware

type UserService

type UserService struct {
	metadata.UserRepo
	Users              []metadata.User              `json:"users"`
	Apps               []metadata.App               `json:"apps"`
	DBs                []metadata.DB                `json:"dbs"`
	MiddlewareClusters []metadata.MiddlewareCluster `json:"middleware_clusters"`
	MySQLClusters      []metadata.MySQLCluster      `json:"mysql_clusters"`
	MySQLServers       []metadata.MySQLServer       `json:"mysql_servers"`
}

UserService struct

func (*UserService) Create

func (us *UserService) Create(fields map[string]interface{}) error

Create creates a user in the middleware

func (*UserService) Delete

func (us *UserService) Delete(id int) error

Delete deletes the user of given id in the middleware

func (*UserService) GetAll

func (us *UserService) GetAll() error

GetAll gets all users

func (*UserService) GetAllMySQLServersByUserID added in v1.1.1

func (us *UserService) GetAllMySQLServersByUserID(id int) error

GetAllMySQLServersByUserID gets mysql servers that this user owns

func (*UserService) GetApps added in v1.1.1

func (us *UserService) GetApps() []metadata.App

GetApps returns the apps of the service

func (*UserService) GetAppsByUserID added in v1.1.1

func (us *UserService) GetAppsByUserID(userID int) error

GetAppsByUserID gets apps that this user owns

func (*UserService) GetByAccountName

func (us *UserService) GetByAccountName(accountName string) error

GetByAccountName gets a user of given account name

func (*UserService) GetByAccountNameOrEmployeeID added in v1.1.1

func (us *UserService) GetByAccountNameOrEmployeeID(loginName string) error

GetByAccountNameOrEmployeeID gets a user of given login name

func (*UserService) GetByEmail

func (us *UserService) GetByEmail(email string) error

GetByEmail gets a user of given email

func (*UserService) GetByEmployeeID

func (us *UserService) GetByEmployeeID(employeeID string) error

GetByEmployeeID gets a user of given employee id

func (*UserService) GetByID

func (us *UserService) GetByID(id int) error

GetByID gets a user by the identity

func (*UserService) GetByMobile

func (us *UserService) GetByMobile(mobile string) error

GetByTelephone gets a user of given mobile

func (*UserService) GetByTelephone

func (us *UserService) GetByTelephone(telephone string) error

GetByTelephone gets a user of given telephone

func (*UserService) GetByUserName added in v1.1.1

func (us *UserService) GetByUserName(userName string) error

GetByUserName gets users of given user name

func (*UserService) GetDBs added in v1.1.1

func (us *UserService) GetDBs() []metadata.DB

GetDBs returns the dbs of the service

func (*UserService) GetDBsByUserID added in v1.1.1

func (us *UserService) GetDBsByUserID(userID int) error

GetDBsByUserID gets dbs that this user owns

func (*UserService) GetMiddlewareClusters added in v1.1.1

func (us *UserService) GetMiddlewareClusters() []metadata.MiddlewareCluster

GetMiddlewareClusters returns the middleware clusters of the service

func (*UserService) GetMiddlewareClustersByUserID added in v1.1.1

func (us *UserService) GetMiddlewareClustersByUserID(userID int) error

GetMiddlewareClustersByUserID gets middleware clusters that this user owns

func (*UserService) GetMySQLClusters added in v1.1.1

func (us *UserService) GetMySQLClusters() []metadata.MySQLCluster

GetMySQLClusters returns the mysql clusters of the service

func (*UserService) GetMySQLClustersByUserID added in v1.1.1

func (us *UserService) GetMySQLClustersByUserID(userID int) error

GetMySQLClustersByUserID gets mysql clusters that this user owns

func (*UserService) GetMySQLServers added in v1.1.1

func (us *UserService) GetMySQLServers() []metadata.MySQLServer

GetMySQLServers returns the mysql servers of the service

func (*UserService) GetUsers

func (us *UserService) GetUsers() []metadata.User

GetUsers returns users of the service

func (*UserService) Marshal

func (us *UserService) Marshal() ([]byte, error)

Marshal marshals UserService.Users to json bytes

func (*UserService) MarshalWithFields

func (us *UserService) MarshalWithFields(fields ...string) ([]byte, error)

MarshalWithFields marshals only specified fields of the UserService to json bytes

func (*UserService) Update

func (us *UserService) Update(id int, fields map[string]interface{}) error

Update gets a user of the given id from the middleware, and then updates its fields that was specified in fields argument, key is the filed name and value is the new field value, it saves the changes to the middleware

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL