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: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	// Identity returns the identity
	Identity() int
	// GetSystemName returns the app name
	GetAppName() string
	// GetLevel returns the level
	GetLevel() int
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// GetDBs gets database identity list that the app uses
	GetDBs() ([]DB, error)
	// GetUsers gets user list that own the app
	GetUsers() ([]User, error)
	// Set sets App with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// AddDB adds a new map of the app and database in the middleware
	AddDB(dbID int) error
	// DeleteDB deletes the map of the app and database in the middleware
	DeleteDB(dbID int) error
	// AddUser adds a new map of the app and user in the middleware
	AddUser(userID int) error
	// DeleteUser deletes the map of the app and user in the middleware
	DeleteUser(userID int) error
	// MarshalJSON marshals App to json bytes
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified fields of the App to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

type AppRepo

type AppRepo interface {
	// Execute executes command with arguments on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all apps from the middleware
	GetAll() ([]App, error)
	// GetByID gets an app by the identity from the middleware
	GetByID(id int) (App, error)
	// GetID gets the identity with given app name from the middleware
	GetID(appName string) (int, error)
	// GetAppSystemByName gets the app by name from the middleware
	GetAppByName(appName string) (App, error)
	// GetDBsByAppID gets databases that app uses
	GetDBsByAppID(id int) ([]DB, error)
	// GetUsersByID gets user list that own the app
	GetUsersByAppID(id int) ([]User, error)
	// Create creates an app in the middleware
	Create(appSystem App) (App, error)
	// Update updates the app in the middleware
	Update(appSystem App) error
	// Delete deletes the app in the middleware
	Delete(id int) error
	// AddDB adds a new map of app and database in the middleware
	AddDB(appID, dbID int) error
	// DeleteDB delete the map of app and database in the middleware
	DeleteDB(appID, dbID int) error
	// AddUser adds a new map of app and user in the middleware
	AddUser(appID, userID int) error
	// DeleteUser delete the map of app and user in the middleware
	DeleteUser(appID, userID int) error
}

type AppService

type AppService interface {
	// GetApps returns apps of the service
	GetApps() []App
	// GetDBs returns dbs of the service
	GetDBs() []DB
	// GetUsers returns users of the service
	GetUsers() []User
	// GetAll gets all apps from the middleware
	GetAll() error
	// GetByID gets an app of the given id from the middleware
	GetByID(id int) error
	// GetAppByName gets App from the middleware by name
	GetAppByName(appName string) error
	// GetDBsByAppID gets databases that the app uses
	GetDBsByAppID(id int) error
	// GetUsersByID gets Users that own the app
	GetUsersByAppID(id int) error
	// Create creates an app in the middleware
	Create(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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the app of given id in the middleware
	Delete(id int) error
	// AddDB adds a new map of app and database in the middleware
	AddDB(appID, dbID int) error
	// DeleteDB deletes the map of app and database in the middleware
	DeleteDB(appID, dbID int) error
	// AddUser adds a new map of app and user in the middleware
	AddUser(appID, userID int) error
	// DeleteUser deletes the map of app and user in the middleware
	DeleteUser(appID, userID int) error
	// Marshal marshals AppService.Apps to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the AppService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

type DB

type DB interface {
	// Identity returns the identity
	Identity() int
	// GetDBName returns the db name
	GetDBName() string
	// GetClusterID returns the cluster id
	GetClusterID() int
	// GetClusterType returns the cluster type
	GetClusterType() int
	// GetEnvID returns the env id
	GetEnvID() int
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// GetApps gets apps that uses this db
	GetApps() ([]App, error)
	// GetMySQLCluster gets the mysql cluster of this db
	GetMySQLCluster() (MySQLCluster, error)
	// GetAppUsers gets the application users of this db
	GetAppUsers() ([]User, error)
	// GetDBUsers gets the db users of this db
	GetDBUsers() ([]User, error)
	// GetAllUsers gets both application and db users of this db
	GetAllUsers() ([]User, error)
	// Set sets DB with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// AddApp adds a new map of the app and database in the middleware
	AddApp(appID int) error
	// DeleteApp deletes a new map of the app and database in the middleware
	DeleteApp(appID int) error
	// DBAddUser adds a new map of the user and database in the middleware
	DBAddUser(userID int) error
	// DBDeleteUser deletes a new map of the user and database in the middleware
	DBDeleteUser(userID int) error
	// MarshalJSON marshals DB to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the DB to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

type DBRepo

type DBRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all databases from the middleware
	GetAll() ([]DB, error)
	// GetByEnv gets databases of given env id from the middleware
	GetByEnv(envID int) ([]DB, error)
	// GetByID gets a database by the identity from the middleware
	GetByID(id int) (DB, error)
	// GetDBByNameAndClusterInfo gets a database by the db name and cluster info from the middleware
	GetDBByNameAndClusterInfo(name string, clusterID, clusterType int) (DB, error)
	// GetDBByNameAndHostInfo gets a database by the db name and host info from the middleware
	GetDBByNameAndHostInfo(name, hostIP string, portNum int) (DB, error)
	// GetDBsByHostInfo gets databases by the  host info from the middleware
	GetDBsByHostInfo(hostIP string, portNum int) ([]DB, error)
	// GetID gets the identity with given database name, cluster id and cluster type from the middleware
	GetID(dbName string, clusterID int, clusterType int) (int, error)
	// GetMySQLClusterByID gets the mysql cluster of the given id from the middleware
	GetMySQLClusterByID(id int) (MySQLCluster, error)
	// GetAppsByDBID gets apps that uses this db
	GetAppsByDBID(id int) ([]App, error)
	// GetAppUsersByDBID gets the application users of the given id from the middleware
	GetAppUsersByDBID(id int) ([]User, error)
	// GetUsersByDBID gets the db users of the given id from the middleware
	GetUsersByDBID(id int) ([]User, error)
	// GetAllUsersByDBID gets both application and db users of the given id from the middleware
	GetAllUsersByDBID(id int) ([]User, error)
	// Create creates a database in the middleware
	Create(db DB) (DB, error)
	// Update updates the database in the middleware
	Update(db DB) error
	// Delete deletes the database in the middleware
	Delete(id int) error
	// AddApp adds a new map of the app and database in the middleware
	AddApp(dbID, appID int) error
	// DeleteApp deletes a map of the app and database in the middleware
	DeleteApp(dbID, appID int) error
	// DBAddUser adds a new map of the user and database in the middleware
	DBAddUser(dbID, userID int) error
	// DBDeleteUser deletes a map of the user and database in the middleware
	DBDeleteUser(dbID, userID int) error
}

type DBService

type DBService interface {
	// GetDBs returns the databases of the service
	GetDBs() []DB
	// GetMySQLCluster returns the mysql cluster of the service
	GetMySQLCluster() MySQLCluster
	// GetApps returns the apps of the service
	GetApps() []App
	// GetUsers returns the users of the service
	GetUsers() []User
	// GetAll gets all databases from the middleware
	GetAll() error
	// GetByEnv gets databases of given env id
	GetByEnv(envID int) error
	// GetByID gets a database of the given id from the middleware
	GetByID(id int) error
	// GetDBByNameAndClusterInfo gets an database of the given db name and cluster info from the middleware
	GetDBByNameAndClusterInfo(name string, clusterID, clusterType int) error
	// GetDBByNameAndHostInfo gets an database of the given db name and host info from the middleware
	GetDBByNameAndHostInfo(name, hostIP string, portNum int) error
	// GetDBsByHostInfo gets databases of given host info from the middleware
	GetDBsByHostInfo(hostIP string, portNum int) error
	// GetMySQLClusterByID gets the cluster of the db
	GetMySQLClusterByID(id int) error
	// GetAppsByDBID gets apps that uses this db
	GetAppsByDBID(id int) error
	// GetAppUsersByDBID gets the application users of the given id
	GetAppUsersByDBID(id int) error
	// GetUsersByDBID gets the db users of the given id
	GetUsersByDBID(id int) error
	// GetAllUsersByDBID gets both application and db users of the given id
	GetAllUsersByDBID(id int) error
	// Create creates a database in the middleware
	Create(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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the database of given id in the middleware
	Delete(id int) error
	// AddApp adds a new map of app and database in the middleware
	AddApp(dbID, appID int) error
	// DeleteApp deletes the map of app and database in the middleware
	DeleteApp(dbID, appID int) error
	// DBAddUser adds a new map of the user and database in the middleware
	DBAddUser(dbID, userID int) error
	// DBDeleteUser deletes a map of the user and database in the middleware
	DBDeleteUser(dbID, userID int) error
	// Marshal marshals DBService.DBs to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the DBService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

type Env

type Env interface {
	// Identity returns the identity
	Identity() int
	// GetEnvName returns the env name
	GetEnvName() string
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// Set sets Env with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// MarshalJSON marshals Env to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified fields of Env to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

type EnvRepo

type EnvRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns middleware.PoolConn, so it can run multiple statements in the same transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all environments from the middleware
	GetAll() ([]Env, error)
	// GetByID gets an environment by the identity from the middleware
	GetByID(id int) (Env, error)
	// GetID gets the identity with given environment name from the middleware
	GetID(envName string) (int, error)
	// GetEnvByName gets Env of given environment name
	GetEnvByName(envName string) (Env, error)
	// Create creates an environment in the middleware
	Create(env Env) (Env, error)
	// Update updates the environment in the middleware
	Update(env Env) error
	// Delete deletes the environment in the middleware
	Delete(id int) error
}

type EnvService

type EnvService interface {
	// GetEnvs returns environments of the service
	GetEnvs() []Env
	// GetAll gets all environments from the middleware
	GetAll() error
	// GetByID gets an environment of the given id from the middleware
	GetByID(id int) error
	// GetEnvByName returns Env of given env name
	GetEnvByName(envName string) error
	// Create creates an environment in the middleware
	Create(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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the environment of given id in the middleware
	Delete(id int) error
	// Marshal marshals EnvService.Envs to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the EnvService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

type IndexStatistic added in v1.1.1

type IndexStatistic interface {
	// GetDBName returns the table schema
	GetDBName() string
	// GetTableName returns the table name
	GetTableName() string
	// GetIndexName returns the index name
	GetIndexName() string
	// GetSequence returns the sequence
	GetSequence() int
	// GetColumnName returns the column name
	GetColumnName() string
	// GetCardinality returns the cardinality
	GetCardinality() int
	// IsUnique returns unique state of index
	IsUnique() bool
	// IsNullable returns the index is nullable or not
	IsNullable() bool
	// MarshalJSON marshals Index to json string
	MarshalJSON() ([]byte, error)
}

type MiddlewareCluster

type MiddlewareCluster interface {
	// Identity returns the identity
	Identity() int
	// GetClusterName returns the cluster name
	GetClusterName() string
	// GetEnvID returns the env id
	GetEnvID() int
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// GetMiddlewareServers gets the middleware server id list of this cluster
	GetMiddlewareServers() ([]MiddlewareServer, error)
	// GetUsersByMiddlewareClusterID gets user list that own the middleware cluster
	GetUsersByMiddlewareClusterID() ([]User, error)
	// Set sets MiddlewareCluster with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// AddUser adds a new map of the middleware cluster and user in the middleware
	AddUser(userID int) error
	// DeleteUser deletes the new map of the middleware cluster and user in the middleware
	DeleteUser(userID int) error
	// MarshalJSON marshals MiddlewareCluster to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the MiddlewareCluster to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

type MiddlewareClusterRepo

type MiddlewareClusterRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all middleware clusters from the middleware
	GetAll() ([]MiddlewareCluster, error)
	// GetByEnv gets middleware clusters of given env id from the middleware
	GetByEnv(envID int) ([]MiddlewareCluster, error)
	// GetByID gets a middleware cluster by the identity from the middleware
	GetByID(id int) (MiddlewareCluster, error)
	// GetByName gets a middleware cluster of given cluster name from the middle ware
	GetByName(clusterName string) (MiddlewareCluster, error)
	// GetID gets the identity with given cluster name and env id from the middleware
	GetID(clusterName string, envID int) (int, error)
	// GetUsersByMiddlewareClusterID get user list that own the middleware cluster
	GetUsersByMiddlewareClusterID(clusterID int) ([]User, error)
	// AddUser adds a new map of middleware cluster and user in the middleware
	AddUser(middlewareClusterID, userID int) error
	// DeleteUser deletes the map of middleware cluster and user in the middleware
	DeleteUser(middlewareClusterID, userID int) error
	// Create creates a middleware cluster in the middleware
	Create(mc MiddlewareCluster) (MiddlewareCluster, error)
	// Update updates the middleware cluster in the middleware
	Update(mc MiddlewareCluster) error
	// Delete deletes the middleware cluster in the middleware
	Delete(id int) error
}

type MiddlewareClusterService

type MiddlewareClusterService interface {
	// GetMiddlewareClusters returns middleware clusters of the service
	GetMiddlewareClusters() []MiddlewareCluster
	// GetMiddlewareServers returns middleware servers of the service
	GetMiddlewareServers() []MiddlewareServer
	// GetAll gets all middleware clusters from the middleware
	GetAll() error
	// GetByEnv gets middleware clusters of given env id
	GetByEnv(envID int) error
	// GetByID gets a middleware cluster of the given id from the middleware
	GetByID(id int) error
	// GetByName gets a middleware cluster of given cluster name
	GetByName(clusterName string) error
	// GetUsers returns users of the service
	GetUsers() []User
	// GetMiddlewareServersByID gets the middleware servers of given cluster id
	GetMiddlewareServersByID(clusterID int) error
	// GetUsersByMiddlewareClusterID  gets Users that own the middleware cluster
	GetUsersByMiddlewareClusterID(clusterID int) error
	// AddUser adds a new map of middleware cluster and user in the middleware
	AddUser(middlewareClusterID, userID int) error
	// DeleteUser deletes the map of middleware cluster and user in the middleware
	DeleteUser(middlewareClusterID, userID int) error
	// Create creates a middleware cluster in the middleware
	Create(fields map[string]interface{}) error
	// Update gets a middleware cluster 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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the middleware cluster of given id in the middleware
	Delete(id int) error
	// Marshal marshals MiddlewareClusterService.MiddlewareClusters to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the MiddlewareClusterService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

type MiddlewareServer

type MiddlewareServer interface {
	// Identity returns the identity
	Identity() int
	// GetClusterID returns the middleware cluster id
	GetClusterID() int
	// GetServerName returns the server name
	GetServerName() string
	// GetMiddlewareRole returns the middleware role
	GetMiddlewareRole() int
	// GetHostIP returns the host ip
	GetHostIP() string
	// GetPortNum returns the port number
	GetPortNum() int
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// Set sets MiddlewareServer with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// MarshalJSON marshals MiddlewareServer to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the MiddlewareServer to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

type MiddlewareServerRepo

type MiddlewareServerRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all middleware servers from the middleware
	GetAll() ([]MiddlewareServer, error)
	// GetByClusterID gets middleware servers with given cluster id
	GetByClusterID(clusterID int) ([]MiddlewareServer, error)
	// GetByID gets a middleware server by the identity from the middleware
	GetByID(id int) (MiddlewareServer, error)
	// GetByHostInfo gets a middleware server with given host ip and port number
	GetByHostInfo(hostIP string, portNum int) (MiddlewareServer, error)
	// GetID gets the identity with given host ip and port number from the middleware
	GetID(hostIP string, portNum int) (int, error)
	// Create creates a middleware server in the middleware
	Create(ms MiddlewareServer) (MiddlewareServer, error)
	// Update updates the middleware server in the middleware
	Update(ms MiddlewareServer) error
	// Delete deletes the middleware server in the middleware
	Delete(id int) error
}

type MiddlewareServerService

type MiddlewareServerService interface {
	// GetMiddlewareServers returns middleware servers of the service
	GetMiddlewareServers() []MiddlewareServer
	// GetAll gets all middleware servers from the middleware
	GetAll() error
	// GetByClusterID gets middleware servers with given cluster id
	GetByClusterID(clusterID int) error
	// GetByID gets a middleware server of the given id from the middleware
	GetByID(id int) error
	// GetByHostInfo gets a middleware server with given host ip and port number
	GetByHostInfo(hostIP string, portNum int) error
	// Create creates a middleware server in the middleware
	Create(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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the middleware server of given id in the middleware
	Delete(id int) error
	// Marshal marshals MiddlewareServerService.MiddlewareServers to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the MiddlewareServerService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

type MonitorSystem

type MonitorSystem interface {
	// Identity returns the identity
	Identity() int
	// GetSystemName returns the system name
	GetSystemName() string
	// GetSystemType returns the system type
	GetSystemType() int
	// GetHostIP returns the host ip
	GetHostIP() string
	// GetPortNum returns the port number
	GetPortNum() int
	// GetPortNumSlow returns the slow log port number
	GetPortNumSlow() int
	// GetBaseURL returns the base url
	GetBaseURL() string
	// GetEnvID returns env id
	GetEnvID() int
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// Set sets DB with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// MarshalJSON marshals DB to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the DB to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

type MonitorSystemRepo

type MonitorSystemRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all monitor systems from the middleware
	GetAll() ([]MonitorSystem, error)
	// GetByEnv gets monitor systems of given env id from the middleware
	GetByEnv(envID int) ([]MonitorSystem, error)
	// GetByID gets a monitor system by the identity from the middleware
	GetByID(id int) (MonitorSystem, error)
	// GetByHostInfo gets a monitor system with given host ip and port number
	GetByHostInfo(hostIP string, portNum int) (MonitorSystem, error)
	// GetID gets the identity with given host ip and port number from the middleware
	GetID(hostIP string, portNum int) (int, error)
	// Create creates a monitor system in the middleware
	Create(ms MonitorSystem) (MonitorSystem, error)
	// Update updates the monitor system in the middleware
	Update(ms MonitorSystem) error
	// Delete deletes the monitor system in the middleware
	Delete(id int) error
}

type MonitorSystemService

type MonitorSystemService interface {
	// GetDBs returns monitor systems of the service
	GetMonitorSystems() []MonitorSystem
	// GetAll gets all monitor systems from the middleware
	GetAll() error
	// GetByEnv gets monitor systems of given env id
	GetByEnv(envID int) error
	// GetByID gets a monitor system of the given id from the middleware
	GetByID(id int) error
	// GetByHostInfo gets a monitor system with given host ip and port number
	GetByHostInfo(hostIP string, portNum int) error
	// Create creates a monitor system in the middleware
	Create(fields map[string]interface{}) error
	// Update gets a monitor system 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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the monitor system of given id in the middleware
	Delete(id int) error
	// Marshal marshals MonitorSystemService.MonitorSystems to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the MonitorSystemService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

type MySQLCluster

type MySQLCluster interface {
	// Identity returns the identity
	Identity() int
	// GetClusterName returns the env name
	GetClusterName() string
	// GetMiddlewareClusterID returns the middleware cluster id
	GetMiddlewareClusterID() int
	// GetMonitorSystemID returns the monitor system id
	GetMonitorSystemID() int
	// GetEnvID returns the env id
	GetEnvID() int
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// GetMySQLServers gets the mysql servers of this cluster
	GetMySQLServers() ([]MySQLServer, error)
	// GetMasterServers gets the master servers of this cluster
	GetMasterServers() ([]MySQLServer, error)
	// GetDBs gets the databases of this cluster
	GetDBs() ([]DB, error)
	// GetResourceGroup get the resource group of this cluster from the middleware
	GetResourceGroup() (ResourceGroup, error)
	// GetUsers gets the users that own the cluster
	GetUsers() ([]User, error)
	// AddUser add a map of the mysql cluster and user in the middleware
	AddUser(userID int) error
	// DeleteUser delete the map of the mysql cluster and user in the middleware
	DeleteUser(userID int) error
	// GetAppUsers gets the application users of this cluster
	GetAppUsers() ([]User, error)
	// GetDBUsers gets the db users of this cluster
	GetDBUsers() ([]User, error)
	// GetAllUsers gets mysql cluster, application and db users of this cluster
	GetAllUsers() ([]User, error)
	// Set sets MySQLCluster with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// MarshalJSON marshals MySQLCluster to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the MySQLCluster to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

MySQLCluster is the entity interface

type MySQLClusterRepo

type MySQLClusterRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all mysql clusters from the middleware
	GetAll() ([]MySQLCluster, error)
	// GetByEnv gets mysql clusters of given env id from the middleware
	GetByEnv(envID int) ([]MySQLCluster, error)
	// GetByID gets a mysql cluster by the identity from the middleware
	GetByID(id int) (MySQLCluster, error)
	// GetByName gets a mysql cluster of given cluster name from the middle ware
	GetByName(clusterName string) (MySQLCluster, error)
	// GetID gets the identity with given cluster name from the middleware
	GetID(clusterName string) (int, error)
	// GetDBsByID gets the databases of the given id from the middleware
	GetDBsByID(id int) ([]DB, error)
	// GetResourceGroupByID get the resource group of the given id from the middleware
	GetResourceGroupByID(id int) (ResourceGroup, error)
	// GetUsersByID gets the users that the mysql cluster uses
	GetUsersByID(id int) ([]User, error)
	// AddUser add a new map of mysql cluster and user in the middleware
	AddUser(mysqlClusterID, userID int) error
	// DeleteUser delete the map of mysql cluster and user in the middleware
	DeleteUser(mysqlClusterID, userID int) error
	// GetAppUsersByID gets the application users of the given id from the middleware
	GetAppUsersByID(id int) ([]User, error)
	// GetDBUsersByID gets the db users of the given id from the middleware
	GetDBUsersByID(id int) ([]User, error)
	// GetAllUsersByID gets mysql cluster, application and db users of the given id from the middleware
	GetAllUsersByID(id int) ([]User, error)
	// Create creates a mysql cluster in the middleware
	Create(mc MySQLCluster) (MySQLCluster, error)
	// Update updates the mysql cluster in the middleware
	Update(mc MySQLCluster) error
	// Delete deletes the mysql cluster in the middleware
	Delete(id int) error
}

MySQLClusterRepo is the repository interface

type MySQLClusterService

type MySQLClusterService interface {
	// GetMySQLClusters returns the mysql clusters of the service
	GetMySQLClusters() []MySQLCluster
	// GetMySQLServers returns the mysql servers of the service
	GetMySQLServers() []MySQLServer
	// GetDBs returns the dbs of the service
	GetDBs() []DB
	// GetAll gets all mysql clusters from the middleware
	GetAll() error
	// GetByEnv gets mysql clusters of given env id
	GetByEnv(envID int) error
	// GetByID gets a mysql cluster of the given id from the middleware
	GetByID(id int) error
	// GetByName gets a mysql cluster of given cluster name
	GetByName(clusterName string) error
	// GetMySQLServersByID gets the mysql servers of given id
	GetMySQLServersByID(id int) error
	// GetMasterServersByID gets the master servers of the given id
	GetMasterServersByID(id int) error
	// GetDBsByID gets the databases of the given id
	GetDBsByID(id int) error
	// GetResourceGroupByID get the resource group of the given id from the middleware
	GetResourceGroupByID(id int) error
	// GetUsersByID gets the user that own the mysql cluster
	GetUsersByID(id int) error
	// AddUser add a new map of mysql cluster and user in the middleware
	AddUser(mysqlClusterID, userID int) error
	// DeleteUser delete the map of mysql cluster and user in the middleware
	DeleteUser(mysqlClusterID, userID int) error
	// GetAppUsersByID gets the application users of the given id
	GetAppUsersByID(id int) error
	// GetDBUsersByID gets the db users of the given id
	GetDBUsersByID(id int) error
	// GetAllUsersByID gets mysql cluster, application and db users of the given id
	GetAllUsersByID(id int) error
	// Create creates a mysql cluster in the middleware
	Create(fields map[string]interface{}) error
	// Update gets a mysql cluster 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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the mysql cluster of given id in the middleware
	Delete(id int) error
	// Marshal marshals MySQLClusterService.MySQLClusters to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the MySQLClusterService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

MySQLClusterService is the service interface

type MySQLServer

type MySQLServer interface {
	// Identity returns the identity
	Identity() int
	// GetClusterID returns the mysql cluster id
	GetClusterID() int
	// GetServerName returns the server name
	GetServerName() string
	// GetServiceName returns the service name
	GetServiceName() string
	// GetHostIP returns the host ip
	GetHostIP() string
	// GetPortNum returns the port number
	GetPortNum() int
	// GetDeploymentType returns the deployment type
	GetDeploymentType() int
	// GetVersion returns the version
	GetVersion() string
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// IsMaster returns if this mysql server is a master node
	IsMaster() (bool, error)
	// GetMySQLCluster gets the mysql cluster of this server
	GetMySQLCluster() (MySQLCluster, error)
	// GetMonitorSystem gets monitor system of this server
	GetMonitorSystem() (MonitorSystem, error)
	// Set sets MySQLServer with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// MarshalJSON marshals MySQLServer to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the MySQLServer to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

MySQLServer is the entity interface

type MySQLServerRepo

type MySQLServerRepo interface {
	// Execute executes given command and placeholders on the mysql
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a mysql.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all mysql servers from the mysql
	GetAll() ([]MySQLServer, error)
	// GetByClusterID gets mysql servers with given cluster id
	GetByClusterID(clusterID int) ([]MySQLServer, error)
	// GetByID gets a mysql server by the identity from the mysql
	GetByID(id int) (MySQLServer, error)
	// GetByHostInfo gets a mysql server with given host ip and port number
	GetByHostInfo(hostIP string, portNum int) (MySQLServer, error)
	// GetID gets the identity with given host ip and port number from the mysql
	GetID(hostIP string, portNum int) (int, error)
	// IsMaster returns if mysql server of given host ip and port number is a master node
	IsMaster(hostIP string, portNum int) (bool, error)
	// GetMySQLClusterByID gets the mysql cluster of the given id
	GetMySQLClusterByID(id int) (MySQLCluster, error)
	// GetMonitorSystem gets monitor system with given mysql server id from the mysql
	GetMonitorSystem(id int) (MonitorSystem, error)
	// Create creates a mysql server in the mysql
	Create(ms MySQLServer) (MySQLServer, error)
	// Update updates the mysql server in the mysql
	Update(ms MySQLServer) error
	// Delete deletes the mysql server in the mysql
	Delete(id int) error
}

MySQLServerRepo is the repository interface

type MySQLServerService

type MySQLServerService interface {
	// GetMySQLServers returns mysql servers of the service
	GetMySQLServers() []MySQLServer
	// GetMySQLCluster returns the mysql cluster of the service
	GetMySQLCluster() MySQLCluster
	// GetAll gets all mysql servers from the mysql
	GetAll() error
	// GetByClusterID gets mysql servers with given cluster id
	GetByClusterID(clusterID int) error
	// GetByID gets a mysql server of the given id from the mysql
	GetByID(id int) error
	// GetByHostInfo gets a mysql server with given host ip and port number
	GetByHostInfo(hostIP string, portNum int) error
	// IsMaster returns if mysql server with given host ip and port number is a master node
	IsMaster(hostIP string, portNum int) (bool, error)
	// GetMySQLClusterByID gets the mysql cluster of the given id
	GetMySQLClusterByID(id int) error
	// Create creates a mysql server in the mysql
	Create(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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the mysql server of given id in the mysql
	Delete(id int) error
	// Marshal marshals MySQLServerService.MySQLServers to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the MySQLServerService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

MySQLServerService is the service interface

type ResourceGroup added in v1.1.1

type ResourceGroup interface {
	// Identity returns the identity
	Identity() int
	// GetGroupUUID returns the resource group uuid
	GetGroupUUID() string
	// GetGroupName returns the resource group name
	GetGroupName() string
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// GetResourceRoles get all resource roles of this resource group
	GetResourceRoles() ([]ResourceRole, error)
	// GetMySQLClusters gets the mysql clusters of this resource group
	GetMySQLClusters() ([]MySQLCluster, error)
	// GetMySQLServers gets the mysql servers of this resource group
	GetMySQLServers() ([]MySQLServer, error)
	// GetMiddlewareClusters gets the mysql clusters of this resource group
	GetMiddlewareClusters() ([]MiddlewareCluster, error)
	// GetMiddlewareServers gets the mysql servers of this resource group
	GetMiddlewareServers() ([]MiddlewareServer, error)
	// GetUsers gets the users of this resource group
	GetUsers() ([]User, error)
	// GetDASAdminUsers gets the das admin users of this resource group
	GetDASAdminUsers() ([]User, error)
	// Set sets the resource group with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// AddMySQLCluster adds mysql cluster to the resource group
	AddMySQLCluster(mysqlClusterID int) error
	// DeleteMySQLCluster deletes mysql cluster from the resource group
	DeleteMySQLCluster(mysqlClusterID int) error
	// AddMiddlewareCluster adds middleware cluster to the resource group
	AddMiddlewareCluster(mysqlClusterID int) error
	// DeleteMiddlewareCluster deletes middleware cluster from the resource group
	DeleteMiddlewareCluster(middlewareClusterID int) error
	// AddResourceRole adds resource role to the resource group
	AddResourceRole(resourceRoleID int) error
	// DeleteResourceRole deletes resource role from the resource group
	DeleteResourceRole(middlewareClusterID int) error
	// MarshalJSON marshals ResourceGroup to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the ResourceGroup to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

ResourceGroup is the entity interface

type ResourceGroupRepo added in v1.1.1

type ResourceGroupRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a mysql.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all resource groups from the middleware
	GetAll() ([]ResourceGroup, error)
	// GetByID gets the resource group by the identity from the middleware
	GetByID(id int) (ResourceGroup, error)
	// GetByGroupUUID gets the resource group with given resource group id from the middleware
	GetByGroupUUID(groupUUID string) (ResourceGroup, error)
	// GetID gets the identity with given resource group id from the middleware
	GetID(groupUUID string) (int, error)
	// GetResourceRolesByID get all resource roles with given resource group id from the middleware
	GetResourceRolesByID(id int) ([]ResourceRole, error)
	// GetMySQLClustersByID gets the mysql cluster with given resource group id from the middleware
	GetMySQLClustersByID(id int) ([]MySQLCluster, error)
	// GetMySQLServersByID gets the mysql servers with given resource group uuid from the middleware
	GetMySQLServersByID(id int) ([]MySQLServer, error)
	// GetMiddlewareClustersByID gets the middleware cluster with given resource group id from the middleware
	GetMiddlewareClustersByID(id int) ([]MiddlewareCluster, error)
	// GetMiddlewareServersByID gets the middleware servers with given resource group uuid from the middleware
	GetMiddlewareServersByID(id int) ([]MiddlewareServer, error)
	// GetUsersByID gets the users with given resource group id from the middleware
	GetUsersByID(id int) ([]User, error)
	// GetDASAdminUsersByID gets the das admin users with given resource group id from the middleware
	GetDASAdminUsersByID(id int) ([]User, error)
	// Create creates a mysql server in the middleware
	Create(resourceGroup ResourceGroup) (ResourceGroup, error)
	// Update updates the mysql server in the middleware
	Update(resourceGroup ResourceGroup) error
	// Delete deletes the mysql server from the middleware
	Delete(id int) error
	// AddMySQLCluster adds mysql cluster to the resource group
	AddMySQLCluster(resourceGroupID int, mysqlClusterID int) error
	// DeleteMySQLCluster deletes mysql cluster from the resource group
	DeleteMySQLCluster(resourceGroupID int, mysqlClusterID int) error
	// AddMiddlewareCluster adds middleware cluster to the resource group
	AddMiddlewareCluster(resourceGroupID int, middlewareClusterID int) error
	// DeleteMiddlewareCluster deletes middleware cluster from the resource group
	DeleteMiddlewareCluster(resourceGroupID, middlewareClusterID int) error
	// AddResourceRole adds resource role to the resource group
	AddResourceRole(resourceGroupID int, resourceRoleID int) error
	// DeleteResourceRole deletes resource role from the resource group
	DeleteResourceRole(resourceGroupID, resourceRoleID int) error
}

ResourceGroupRepo is the repository interface

type ResourceGroupService added in v1.1.1

type ResourceGroupService interface {
	// GetResourceGroups returns resource groups of the service
	GetResourceGroups() []ResourceGroup
	// GetMySQLCluster returns the mysql clusters of the service
	GetMySQLClusters() []MySQLCluster
	// GetMySQLServers returns the mysql servers of the service
	GetMySQLServers() []MySQLServer
	// GetMiddlewareClusters returns the middleware clusters of the service
	GetMiddlewareClusters() []MiddlewareCluster
	// GetMiddlewareServers returns the middleware servers of the service
	GetMiddlewareServers() []MiddlewareServer
	// GetResourceRoles returns the resource roles of the service
	GetResourceRoles() []ResourceRole
	// GetUsers returns the users of the service
	GetUsers() []User
	// GetAll gets all mysql servers from the mysql
	GetAll() error
	// GetByID gets the resource group of the given id
	GetByID(id int) error
	// GetByGroupUUID gets the resource group by group uuid
	GetByGroupUUID(groupUUID string) error
	// GetResourceRolesByID get all resource roles with given resource group id
	GetResourceRolesByID(id int) error
	// GetMySQLClustersByID gets the mysql clusters with given resource group id
	GetMySQLClustersByID(id int) error
	// GetMySQLServersByID gets the mysql servers with given resource group id
	GetMySQLServersByID(id int) error
	// GetMiddlewareClustersByID gets the middleware clusters with given resource group id
	GetMiddlewareClustersByID(id int) error
	// GetMiddlewareServersByID gets the middleware servers with given resource group id
	GetMiddlewareServersByID(id int) error
	// GetUsersByID gets the users with given resource group id
	GetUsersByID(id int) error
	// GetDASAdminUsersByID gets the das admin users with given resource group id
	GetDASAdminUsersByID(id int) error
	// GetResourceRolesByGroupUUID get all resource roles with given resource group uuid
	GetResourceRolesByGroupUUID(groupUUID string) error
	// GetMySQLClustersByGroupUUID gets the mysql clusters with given resource group uuid
	GetMySQLClustersByGroupUUID(groupUUID string) error
	// GetMySQLServersByGroupUUID gets the mysql servers with given resource group uuid
	GetMySQLServersByGroupUUID(groupUUID string) error
	// GetMiddlewareClustersByGroupUUID gets the middleware clusters with given resource group uuid
	GetMiddlewareClustersByGroupUUID(groupUUID string) error
	// GetMiddlewareServersByGroupUUID gets the middleware servers with given resource group uuid
	GetMiddlewareServersByGroupUUID(groupUUID string) error
	// GetUsersByGroupUUID gets the users with given resource group uuid
	GetUsersByGroupUUID(groupUUID string) error
	// GetDASAdminUsersByGroupUUID gets the das admin users with given resource group uuid
	GetDASAdminUsersByGroupUUID(groupUUID string) error
	// Create creates a mysql server in the mysql
	Create(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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the mysql server of given id
	Delete(id int) error
	// AddMySQLCluster adds mysql cluster to the resource group
	AddMySQLCluster(resourceGroupID int, mysqlClusterID int) error
	// DeleteMySQLCluster deletes mysql cluster from the resource group
	DeleteMySQLCluster(resourceGroupID int, mysqlClusterID int) error
	// AddMiddlewareCluster adds middleware cluster to the resource group
	AddMiddlewareCluster(resourceGroupID int, middlewareClusterID int) error
	// DeleteMiddlewareCluster deletes middleware cluster from the resource group
	DeleteMiddlewareCluster(resourceGroupID int, middlewareClusterID int) error
	// AddResourceRole adds resource role to the resource group
	AddResourceRole(resourceGroupID int, resourceRoleID int) error
	// DeleteResourceRole deletes resource role from the resource group
	DeleteResourceRole(resourceGroupID int, resourceRoleID int) error
	// Marshal marshals ResourceGroupService.ResourceGroups to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the ResourceGroupService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

ResourceGroupService is the service interface

type ResourceRole added in v1.1.1

type ResourceRole interface {
	// Identity returns the identity
	Identity() int
	// GetRoleUUID returns the resource role uuid
	GetRoleUUID() string
	// GetRoleName returns the resource role name
	GetRoleName() string
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// GetResourceGroups gets the resource group which this role belongs to
	GetResourceGroups() ([]ResourceGroup, error)
	// GetUsers gets the users of this resource role
	GetUsers() ([]User, error)
	// Set sets the resource group with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// AddResourceGroup adds a map of resource role and resource group
	AddResourceGroup(resourceGroupID int) error
	// DeleteResourceGroup deletes the map of resource role and resource
	DeleteResourceGroup(resourceGroupID int) error
	// AddUser adds a map of the resource role and user
	AddUser(userID int) error
	// DeleteUser deletes the map of the resource role and user
	DeleteUser(userID int) error
	// MarshalJSON marshals ResourceRole to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the ResourceRole to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

ResourceRole is the entity interface

type ResourceRoleRepo added in v1.1.1

type ResourceRoleRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a mysql.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all resource groups from the middleware
	GetAll() ([]ResourceRole, error)
	// GetByID gets the resource role by the identity from the middleware
	GetByID(id int) (ResourceRole, error)
	// GetID gets the identity with given resource role id from the middleware
	GetID(groupUUID string) (int, error)
	// GetByRoleUUID gets the resource role with given resource role id from the middleware
	GetByRoleUUID(roleUUID string) (ResourceRole, error)
	// GetResourceGroups gets the resource group which this role belongs to with given resource role id from the middleware
	GetResourceGroupsByID(id int) ([]ResourceGroup, error)
	// GetUsersByID gets the users with given resource group id from the middleware
	GetUsersByID(id int) ([]User, error)
	// Create creates a mysql server in the middleware
	Create(rr ResourceRole) (ResourceRole, error)
	// Update updates the mysql server in the middleware
	Update(rr ResourceRole) error
	// Delete deletes the mysql server in the middleware
	Delete(id int) error
	// AddResourceGroup adds a map of resource role and resource group in the middleware
	AddResourceGroup(resourceRoleID int, resourceGroupID int) error
	// DeleteResourceGroup deletes the map of resource role and resource group from the middleware
	DeleteResourceGroup(resourceRoleID int, resourceGroupID int) error
	// AddUser adds a map of the resource role and user in the middleware
	AddUser(resourceRoleID int, userID int) error
	// DeleteUser deletes the map of the resource role and user from the middleware
	DeleteUser(resourceRoleID int, userID int) error
}

ResourceRoleRepo is the repository interface

type ResourceRoleService added in v1.1.1

type ResourceRoleService interface {
	// GetResourceRoles returns the resource roles of the service
	GetResourceRoles() []ResourceRole
	// GetResourceGroups returns the resource group of the service
	GetResourceGroups() []ResourceGroup
	// GetUsers returns the users of the service
	GetUsers() []User
	// GetAll gets all resource roles
	GetAll() error
	// GetByID gets the resource role of the given id
	GetByID(id int) error
	// GetByRoleUUID gets the resource role by role uuid
	GetByRoleUUID(groupUUID string) error
	// GetResourceGroupsByID gets the resource group with given resource role id
	GetResourceGroupsByID(id int) error
	// GetUsersByID gets the users with given resource role id
	GetUsersByID(id int) error
	// GetUsersByRoleUUID gets the users with given resource role uuid
	GetUsersByRoleUUID(roleUUID string) error
	// Create creates a resource role in resource group
	Create(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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the resource role of given id
	Delete(id int) error
	// AddResourceGroup adds a map of resource role and resource group
	AddResourceGroup(resourceRoleID int, resourceGroupID int) error
	// DeleteResourceGroup deletes the map of resource role and resource group
	DeleteResourceGroup(resourceRoleID int, resourceGroupID int) error
	// AddUser adds a map of the resource role and user
	AddUser(resourceRoleID int, userID int) error
	// DeleteUser deletes the map of the resource role and user
	DeleteUser(resourceRoleID int, userID int) error
	// Marshal marshals ResourceRoleService.ResourceRoles to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the ResourceRoleService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

ResourceRoleService is the service interface

type Table added in v1.1.1

type Table interface {
	// GetDBName returns the table schema
	GetDBName() string
	// GetTableName returns the table name
	GetTableName() string
	// GetTableStatistics returns the table statistics
	GetTableStatistics() ([]TableStatistic, error)
	// GetIndexStatistics returns the index statistics
	GetIndexStatistics() ([]IndexStatistic, error)
	// GetCreateStatement returns the create statement
	GetCreateStatement() (string, error)
	// MarshalJSON marshals Table to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the Table to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

type TableRepo added in v1.1.1

type TableRepo interface {
	// Close closes the mysql connection
	Close() error
	// InitMySQLConn initialize the mysql connection of the repository
	InitMySQLConn(hostIP string, portNum int, dbName string) error
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// GetByDBName gets the table info by db name from middleware
	GetByDBName(dbName string) ([]Table, error)
	// GetTableStatistics gets table statistics from the middleware
	GetTableStatistics(dbName, tableName string) ([]TableStatistic, error)
	// GetIndexStatistics gets index statistics from the middleware
	GetIndexStatistics(dbName, tableName string) ([]IndexStatistic, error)
	// GetCreateStatement gets the create statement of the table
	GetCreateStatement(dbName, tableName string) (string, error)
	// GetStatisticsByDBNameAndTableName gets the full table info by db name and table name from middleware
	GetStatisticsByDBNameAndTableName(dbName, tableName string) ([]TableStatistic, []IndexStatistic, string, error)
	// AnalyzeTableByDBNameAndTableName analyzes the table by db name and table name
	AnalyzeTableByDBNameAndTableName(dbName, tableName string) error
}

type TableService added in v1.1.1

type TableService interface {
	// GetTables returns the tables list
	GetTables() []Table
	// GetByHostInfoAndDBName returns tables info by db name
	GetByDBID(dbID int) error
	// GetStatisticsByDBIDAndTableName gets the table statistics by db id and table name
	GetStatisticsByDBIDAndTableName(dbID int, tableName string) error
	// GetStatisticsByHostInfoAndDBNameAndTableName gets the table statistics by host info and db name and table name
	GetStatisticsByHostInfoAndDBNameAndTableName(hostIP string, portNum int, dbName, tableName string) error
	// AnalyzeTableByDBIDAndTableName analyzes the table by db id and table name
	AnalyzeTableByDBIDAndTableName(dbID int, tableName string) error
	// AnalyzeTableByHostInfoAndDBNameAndTableName analyzes the table by host info and db name and table name
	AnalyzeTableByHostInfoAndDBNameAndTableName(hostIP string, portNum int, dbName, tableName string) error
	// Marshal marshals TableService.Tables to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the TableService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

type TableStatistic added in v1.1.1

type TableStatistic interface {
	// GetDBName returns the table schema
	GetDBName() string
	// GetTableName returns the table name
	GetTableName() string
	// GetTableRows returns the rows of the table
	GetTableRows() int
	// GetSize returns the size of the table
	GetSize() int
	// GetSizeMB returns the size(MB) of the table
	GetSizeMB() float64
	// GetAvgRowLength returns the average row length of the table
	GetAvgRowLength() int
	// GetAutoIncrement returns the state of auto increment
	GetAutoIncrement() int
	// GetEngine returns the engine type of the table
	GetEngine() string
	// GetCharSet returns the charset of the table
	GetCharSet() string
	// GetCollation returns the collation of the table
	GetCollation() string
	// GetCreateTime returns the create time of the table
	GetCreateTime() time.Time
	// MarshalJSON marshals Table to json string
	MarshalJSON() ([]byte, error)
}

type User

type User interface {
	// Identity returns the identity
	Identity() int
	// GetUserName returns the username
	GetUserName() string
	// GetDepartmentName returns the department name
	GetDepartmentName() string
	// GetEmployeeID returns the employee id
	GetEmployeeID() string
	// GetAccountName returns the account name
	GetAccountName() string
	// GetEmail returns the email
	GetEmail() string
	// GetEmail returns the telephone
	GetTelephone() string
	// GetMobile returns the mobile
	GetMobile() string
	// GetRole returns the role
	GetRole() int
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetAllMySQLServers gets all mysql servers of this user from the middleware
	GetAllMySQLServers() ([]MySQLServer, error)
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// Set sets User with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// Delete sets DelFlag to 1
	Delete()
	// MarshalJSON marshals User to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSONWithFields marshals only specified field of the User to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

type UserRepo

type UserRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetAll gets all databases from the middleware
	GetAll() ([]User, error)
	// GetID gets the identity with given account name from the middleware
	GetID(accountName string) (int, error)
	// GetByID gets a user by the identity from the middleware
	GetByID(id int) (User, error)
	// GetByUserName gets users of given username from the middleware
	GetByUserName(userName string) ([]User, error)
	// GetByEmployeeID gets a user of given employee id from the middleware
	GetByEmployeeID(employeeID string) (User, error)
	// GetByAccountName gets a user of given account name from the middleware
	GetByAccountName(accountName string) (User, error)
	// GetByEmail gets a user of given email from the middleware
	GetByEmail(email string) (User, error)
	// GetByTelephone gets a user of given telephone from the middleware
	GetByTelephone(telephone string) (User, error)
	// GetByTelephone gets a user of given mobile from the middleware
	GetByMobile(mobile string) (User, error)
	// GetByAccountNameOrEmployeeID gets a user of given loginName from the middleware
	GetByAccountNameOrEmployeeID(loginName string) (User, error)
	// GetAppsByUserID gets app list that this user owns
	GetAppsByUserID(id int) ([]App, error)
	// GetDBsByUserID gets app list that this user owns
	GetDBsByUserID(id int) ([]DB, error)
	// GetMiddlewareClustersByUserID gets middleware cluster list that this user owns
	GetMiddlewareClustersByUserID(id int) ([]MiddlewareCluster, error)
	// GetMySQLClustersByUserID gets mysql cluster list that this user owns
	GetMySQLClustersByUserID(id int) ([]MySQLCluster, error)
	// GetAllMySQLServersByUserID gets mysql servers list that this user owns
	GetAllMySQLServersByUserID(id int) ([]MySQLServer, error)
	// Create creates a user in the middleware
	Create(db User) (User, error)
	// Update updates a user in the middleware
	Update(db User) error
	// Delete deletes a user in the middleware
	Delete(id int) error
}

type UserService

type UserService interface {
	// GetUsers returns users of the service
	GetUsers() []User
	// GetApps returns the apps of the service
	GetApps() []App
	// GetDBs returns the dbs of the service
	GetDBs() []DB
	// GetMiddlewareClusters returns the middleware clusters of the service
	GetMiddlewareClusters() []MiddlewareCluster
	// GetMySQLClusters returns the mysql clusters of the service
	GetMySQLClusters() []MySQLCluster
	// GetMySQLClusters returns the mysql servers of the service
	GetMySQLServers() []MySQLServer
	// GetAll gets all users
	GetAll() error
	// GetByID gets a user by the identity
	GetByID(id int) error
	// GetByUserName gets users of given user name
	GetByUserName(userName string) error
	// GetByEmployeeID gets a user of given employee id
	GetByEmployeeID(employeeID string) error
	// GetByAccountName gets a user of given account name
	GetByAccountName(accountName string) error
	// GetByEmail gets a user of given email
	GetByEmail(email string) error
	// GetByTelephone gets a user of given telephone
	GetByTelephone(telephone string) error
	// GetByTelephone gets a user of given mobile
	GetByMobile(mobile string) error
	// GetByAccountNameOrEmployeeID gets a user of given login name from the middleware
	GetByAccountNameOrEmployeeID(loginName string) error
	// GetAppsByUserID gets apps that this user owns
	GetAppsByUserID(id int) error
	// GetDBsByUserID gets apps that this user owns
	GetDBsByUserID(id int) error
	// GetMiddlewareClustersByUserID gets middleware clusters that this user owns
	GetMiddlewareClustersByUserID(id int) error
	// GetMySQLClustersByUserID gets mysql clusters that this user owns
	GetMySQLClustersByUserID(id int) error
	// GetAllMySQLServersByUserID gets mysql servers list that this user owns
	GetAllMySQLServersByUserID(id int) error
	// Create creates a user in the middleware
	Create(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
	Update(id int, fields map[string]interface{}) error
	// Delete deletes the user of given id in the middleware
	Delete(id int) error
	// Marshal marshals UserService.Users to json bytes
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified fields of the UserService to json bytes
	MarshalWithFields(fields ...string) ([]byte, error)
}

Jump to

Keyboard shortcuts

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