metadata

package
v0.0.0-...-ddd43b2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppSystemInfo

type AppSystemInfo struct {
	dependency.Repository
	ID             int       `middleware:"id" json:"id"`
	AppSystemName  string    `middleware:"system_name" json:"system_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"`
	Level          int       `middleware:"level" json:"level"`
	OwnerID        int       `middleware:"owner_id" json:"owner_id"`
	OwnerGroup     string    `middleware:"owner_group" json:"owner_group"`
}

func NewAppSystemInfo

func NewAppSystemInfo(repo *AppSystemRepo, id int, appSystemName string, delFlag int, createTime time.Time, lastUpdateTime time.Time, level int, ownerID int, ownerGroup string) *AppSystemInfo

NewAppSystemInfo returns a new AppSystemInfo

func NewAppSystemInfoWithDefault

func NewAppSystemInfoWithDefault(appSystemName string, level int, ownerID int, ownerGroup string) *AppSystemInfo

NewAppSystemInfoWithDefault returns a new AppSystemInfo with default AppSystemRepo

func NewAppSystemInfoWithGlobal

func NewAppSystemInfoWithGlobal(id int, appSystemName string, delFlag int, createTime time.Time, lastUpdateTime time.Time, level int, ownerID int, ownerGroup string) *AppSystemInfo

NewAppSystemInfo returns a new AppSystemInfo with default AppSystemRepo

func NewEmptyAppSystemInfoWithGlobal

func NewEmptyAppSystemInfoWithGlobal() *AppSystemInfo

func (*AppSystemInfo) Delete

func (asi *AppSystemInfo) Delete()

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

func (*AppSystemInfo) Get

func (asi *AppSystemInfo) Get(field string) (interface{}, error)

Get returns value of given field

func (*AppSystemInfo) GetCreateTime

func (asi *AppSystemInfo) GetCreateTime() time.Time

GetCreateTime returns created time of entity

func (*AppSystemInfo) GetLastUpdateTime

func (asi *AppSystemInfo) GetLastUpdateTime() time.Time

GetLastUpdateTime returns last updated time of entity

func (*AppSystemInfo) GetLevel

func (asi *AppSystemInfo) GetLevel() int

GetLevel returns last updated time of entity

func (*AppSystemInfo) GetOwnerGroup

func (asi *AppSystemInfo) GetOwnerGroup() string

GetOwnerGroup returns last updated time of entity

func (*AppSystemInfo) GetOwnerID

func (asi *AppSystemInfo) GetOwnerID() int

GetOwnerID returns last updated time of entity

func (*AppSystemInfo) Identity

func (asi *AppSystemInfo) Identity() string

Identity returns ID of entity

func (*AppSystemInfo) IsDeleted

func (asi *AppSystemInfo) IsDeleted() bool

IsDeleted checks if delete flag had been set

func (*AppSystemInfo) MarshalJSON

func (asi *AppSystemInfo) MarshalJSON() ([]byte, error)

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

func (*AppSystemInfo) MarshalJSONWithFields

func (asi *AppSystemInfo) MarshalJSONWithFields(fields ...string) ([]byte, error)

MarshalJSONWithFields marshals only with specified fields of entity to json string

func (*AppSystemInfo) Set

func (asi *AppSystemInfo) 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 AppSystemRepo

type AppSystemRepo struct {
	Database middleware.Pool
}

func NewAppSystemRepo

func NewAppSystemRepo(db middleware.Pool) *AppSystemRepo

NewAppSystemRepo returns *AppSystemRepo with given middleware.Pool

func NewAppSystemRepoWithGlobal

func NewAppSystemRepoWithGlobal() *AppSystemRepo

NewAppSystemRepoWithGlobal returns *AppSystemRepo with global mysql pool

func (*AppSystemRepo) Create

func (asr *AppSystemRepo) Create(entity dependency.Entity) (dependency.Entity, error)

Create creates data with given entity in the middleware

func (*AppSystemRepo) Delete

func (asr *AppSystemRepo) Delete(id string) error

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

func (*AppSystemRepo) Execute

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

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

func (*AppSystemRepo) GetAll

func (asr *AppSystemRepo) GetAll() ([]dependency.Entity, error)

GetAll returns all available entities

func (*AppSystemRepo) GetByID

func (asr *AppSystemRepo) GetByID(id string) (dependency.Entity, error)

func (*AppSystemRepo) GetID

func (asr *AppSystemRepo) GetID(entity dependency.Entity) (string, error)

GetID checks identity of given entity from the middleware

func (*AppSystemRepo) Transaction

func (asr *AppSystemRepo) Transaction() (middleware.Transaction, error)

func (*AppSystemRepo) Update

func (asr *AppSystemRepo) Update(entity dependency.Entity) error

Update updates data with given entity in the middleware

type AppSystemService

type AppSystemService struct {
	dependency.Repository
	Entities []dependency.Entity
}

func NewAppSystemService

func NewAppSystemService(repo dependency.Repository) *AppSystemService

NewAppSystemService returns a new *AppSystemService

func NewAppSystemServiceWithDefault

func NewAppSystemServiceWithDefault() *AppSystemService

NewAppSystemServiceWithDefault returns a new *AppSystemService with default repository

func (*AppSystemService) Create

func (ass *AppSystemService) Create(fields map[string]interface{}) error

Create creates entity and insert it into the middleware

func (*AppSystemService) Delete

func (ass *AppSystemService) Delete(id string) error

Delete delet entity that contains the given id in the middleware

func (*AppSystemService) GetAll

func (ass *AppSystemService) GetAll() error

GetAll ge entities from the middleware

func (*AppSystemService) GetByID

func (ass *AppSystemService) GetByID(id string) error

GetByID g entity that contains the given id from the middleware

func (*AppSystemService) GetEntities

func (ass *AppSystemService) GetEntities() []dependency.Entity

GetEntities returns entities of the service

func (*AppSystemService) Marshal

func (ass *AppSystemService) Marshal() ([]byte, error)

Marshal marshals service.Entities

func (*AppSystemService) MarshalWithFields

func (ass *AppSystemService) MarshalWithFields(fields ...string) ([]byte, error)

Marshal marshals service.Entities with given fields

func (*AppSystemService) Update

func (ass *AppSystemService) Update(id string, fields map[string]interface{}) error

Update gets an AppSystem 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 DbInfo

type DbInfo struct {
	dependency.Repository
	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"`
	OwnerId        string    `middleware:"owner_id" json:"owner_id"`
	OwnerGroup     string    `middleware:"owner_group" json:"owner_group"`
	EnvId          string    `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 NewDbInfo

func NewDbInfo(repo *DbRepo, id int, dbName string, clusterId int, clusterType int, ownerId string, ownerGroup string, envId string, delFlag int, createTime time.Time, lastUpdateTime time.Time) *DbInfo

NewDbInfo returns a new DbInfo

func NewDbInfoWithDefault

func NewDbInfoWithDefault(dbName, ownerId, envId string) *DbInfo

NewDbInfoWithDefault returns a new DbInfo with default DbRepo

func NewDbInfoWithGlobal

func NewDbInfoWithGlobal(id int, dbName string, clusterId int, clusterType int, ownerId string, ownerGroup string, envId string, delFlag int, createTime time.Time, lastUpdateTime time.Time) *DbInfo

NewDbInfo returns a new DbInfo with default DbRepo

func NewEmptyDbInfoWithGlobal

func NewEmptyDbInfoWithGlobal() *DbInfo

func (*DbInfo) Delete

func (ei *DbInfo) Delete()

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

func (*DbInfo) Get

func (ei *DbInfo) Get(field string) (interface{}, error)

Get returns value of given field

func (*DbInfo) GetCreateTime

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

GetCreateTime returns created time of entity

func (*DbInfo) GetLastUpdateTime

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

GetLastUpdateTime returns last updated time of entity

func (*DbInfo) Identity

func (ei *DbInfo) Identity() string

Identity returns ID of entity

func (*DbInfo) IsDeleted

func (ei *DbInfo) IsDeleted() bool

IsDeleted checks if delete flag had been set

func (*DbInfo) MarshalJSON

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

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

func (*DbInfo) MarshalJSONWithFields

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

MarshalJSONWithFields marshals only with specified fields of entity to json string

func (*DbInfo) Set

func (ei *DbInfo) 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 DbRepo

type DbRepo struct {
	Database middleware.Pool
}

func NewDbRepo

func NewDbRepo(db middleware.Pool) *DbRepo

NewDbRepo returns *DbRepo with given middleware.Pool

func NewDbRepoWithGlobal

func NewDbRepoWithGlobal() *DbRepo

NewDbRepo returns *DbRepo with global mysql pool

func (*DbRepo) Create

func (er *DbRepo) Create(entity dependency.Entity) (dependency.Entity, error)

Create creates data with given entity in the middleware

func (*DbRepo) Delete

func (er *DbRepo) Delete(id string) error

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

func (*DbRepo) Execute

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

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

func (*DbRepo) GetAll

func (er *DbRepo) GetAll() ([]dependency.Entity, error)

GetAll returns all available entities

func (*DbRepo) GetByID

func (er *DbRepo) GetByID(id string) (dependency.Entity, error)

func (*DbRepo) GetID

func (er *DbRepo) GetID(entity dependency.Entity) (string, error)

GetID checks identity of given entity from the middleware

func (*DbRepo) Transaction

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

func (*DbRepo) Update

func (er *DbRepo) Update(entity dependency.Entity) error

Update updates data with given entity in the middleware

type DbService

type DbService struct {
	dependency.Repository
	Entities []dependency.Entity
}

func NewDbService

func NewDbService(repo dependency.Repository) *DbService

NewDbService returns a new *DbService

func NewDbServiceWithDefault

func NewDbServiceWithDefault() *DbService

NewDbServiceWithDefault returns a new *DbService with default repository

func (*DbService) Create

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

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

func (*DbService) Delete

func (es *DbService) Delete(id string) error

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

func (*DbService) GetAll

func (es *DbService) GetAll() error

GetAll gets all database entities from the middleware

func (*DbService) GetByID

func (es *DbService) GetByID(id string) error

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

func (*DbService) GetEntities

func (es *DbService) GetEntities() []dependency.Entity

GetEntities returns entities of the service

func (*DbService) Marshal

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

Marshal marshals service.Entities

func (*DbService) MarshalWithFields

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

Marshal marshals service.Entities with given fields

func (*DbService) Update

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

Update gets an database 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 EnvInfo

type EnvInfo struct {
	dependency.Repository
	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 NewEmptyEnvInfoWithGlobal

func NewEmptyEnvInfoWithGlobal() *EnvInfo

NewEmptyEnvInfoWithGlobal returns a new *EnvInfo with global repository

func NewEnvInfo

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

NewEnvInfo returns a new *EnvInfo

func NewEnvInfoWithDefault

func NewEnvInfoWithDefault(envName string) *EnvInfo

NewEnvInfoWithDefault returns a new *EnvInfo with default EnvRepo

func NewEnvInfoWithGlobal

func NewEnvInfoWithGlobal(id int, envName string, delFlag int, createTime time.Time, lastUpdateTime time.Time) *EnvInfo

NewEnvInfo returns a new *EnvInfo with default EnvRepo

func NewEnvInfoWithMapAndRandom

func NewEnvInfoWithMapAndRandom(fields map[string]interface{}) (*EnvInfo, error)

NewEnvInfoWithMapAndRandom returns a new *EnvInfo with given map

func (*EnvInfo) Delete

func (ei *EnvInfo) Delete()

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

func (*EnvInfo) Get

func (ei *EnvInfo) Get(field string) (interface{}, error)

Get returns value of given field

func (*EnvInfo) GetCreateTime

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

GetCreateTime returns created time of entity

func (*EnvInfo) GetLastUpdateTime

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

GetLastUpdateTime returns last updated time of entity

func (*EnvInfo) Identity

func (ei *EnvInfo) Identity() string

Identity returns ID of entity

func (*EnvInfo) IsDeleted

func (ei *EnvInfo) IsDeleted() bool

IsDeleted checks if delete flag had been set

func (*EnvInfo) MarshalJSON

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

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

func (*EnvInfo) MarshalJSONWithFields

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

MarshalJSONWithFields marshals only with specified fields of entity 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 NewEnvRepo

func NewEnvRepo(db middleware.Pool) *EnvRepo

NewEnvRepo returns *EnvRepo with given middleware.Pool

func NewEnvRepoWithGlobal

func NewEnvRepoWithGlobal() *EnvRepo

NewEnvRepoWithGlobal returns *EnvRepo with global mysql pool

func (*EnvRepo) Create

func (er *EnvRepo) Create(entity dependency.Entity) (dependency.Entity, error)

Create creates data with given entity in the middleware

func (*EnvRepo) Delete

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

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

func (*EnvRepo) Execute

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

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

func (*EnvRepo) GetAll

func (er *EnvRepo) GetAll() ([]dependency.Entity, error)

GetAll returns all available entities

func (*EnvRepo) GetByID

func (er *EnvRepo) GetByID(id string) (dependency.Entity, error)

func (*EnvRepo) GetID

func (er *EnvRepo) GetID(entity dependency.Entity) (string, error)

GetID checks identity of given entity from the middleware

func (*EnvRepo) Transaction

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

Transaction implements dependency.Repository interface

func (*EnvRepo) Update

func (er *EnvRepo) Update(entity dependency.Entity) error

Update updates data with given entity in the middleware

type EnvService

type EnvService struct {
	dependency.Repository
	Entities []dependency.Entity
}

EnvService implements Service interface

func NewEnvService

func NewEnvService(repo dependency.Repository) *EnvService

NewEnvService returns a new *EnvService

func NewEnvServiceWithDefault

func NewEnvServiceWithDefault() *EnvService

NewEnvServiceWithDefault returns a new *EnvService with default repository

func (*EnvService) Create

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

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

func (*EnvService) Delete

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

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

func (*EnvService) GetAll

func (es *EnvService) GetAll() error

GetAll gets all environment entities from the middleware

func (*EnvService) GetByID

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

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

func (*EnvService) GetEntities

func (es *EnvService) GetEntities() []dependency.Entity

GetEntities returns entities of the service

func (*EnvService) Marshal

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

Marshal marshals service.Entities

func (*EnvService) MarshalWithFields

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

MarshalWithFields marshals service.Entities with given fields

func (*EnvService) Update

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

Update gets an environment 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 MSInfo

type MSInfo struct {
	dependency.Repository
	ID             int       `middleware:"id" json:"id"`
	MSName         string    `middleware:"system_name" json:"system_name"`
	SystemType     string    `middleware:"system_type" json:"system_type"`
	HostIp         string    `middleware:"host_ip" json:"host_ip"`
	PortNum        string    `middleware:"port_num" json:"port_num"`
	PortNumSlow    string    `middleware:"port_num_slow" json:"port_num_slow"`
	BaseUrl        string    `middleware:"base_url" json:"base_url"`
	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 NewEmptyMSInfoWithGlobal

func NewEmptyMSInfoWithGlobal() *MSInfo

func NewMSInfo

func NewMSInfo(repo *MSRepo, id int, systemName string, systemType string, hostIp string, portNum string, portNumSlow string, baseUrl string, delFlag int, createTime time.Time, lastUpdateTime time.Time) *MSInfo

NewMSInfo returns a new MSInfo

func NewMSInfoWithDefault

func NewMSInfoWithDefault(mSName, systemType, hostIp, portNum, portNumSlow, baseUrl string) *MSInfo

NewMSInfoWithDefault returns a new MSInfo with default MSRepo

func NewMSInfoWithGlobal

func NewMSInfoWithGlobal(id int, mSName, systemType, hostIp, portNum, portNumSlow, baseUrl string, delFlag int, createTime time.Time, lastUpdateTime time.Time) *MSInfo

NewMSInfo returns a new MSInfo with default MSRepo

func (*MSInfo) Delete

func (ei *MSInfo) Delete()

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

func (*MSInfo) Get

func (ei *MSInfo) Get(field string) (interface{}, error)

Get returns value of given field

func (*MSInfo) GetCreateTime

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

GetCreateTime returns created time of entity

func (*MSInfo) GetLastUpdateTime

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

GetLastUpdateTime returns last updated time of entity

func (*MSInfo) Identity

func (ei *MSInfo) Identity() string

Identity returns ID of entity

func (*MSInfo) IsDeleted

func (ei *MSInfo) IsDeleted() bool

IsDeleted checks if delete flag had been set

func (*MSInfo) MarshalJSON

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

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

func (*MSInfo) MarshalJSONWithFields

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

MarshalJSONWithFields marshals only with specified fields of entity to json string

func (*MSInfo) Set

func (ei *MSInfo) 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 MSRepo

type MSRepo struct {
	Database middleware.Pool
}

func NewMSRepo

func NewMSRepo(db middleware.Pool) *MSRepo

NewMSRepo returns *MSRepo with given middleware.Pool

func NewMSRepoWithGlobal

func NewMSRepoWithGlobal() *MSRepo

NewMSRepo returns *MSRepo with global mysql pool

func (*MSRepo) Create

func (er *MSRepo) Create(entity dependency.Entity) (dependency.Entity, error)

Create creates data with given entity in the middleware

func (*MSRepo) Delete

func (er *MSRepo) Delete(id string) error

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

func (*MSRepo) Execute

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

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

func (*MSRepo) GetAll

func (er *MSRepo) GetAll() ([]dependency.Entity, error)

GetAll returns all available entities

func (*MSRepo) GetByID

func (er *MSRepo) GetByID(id string) (dependency.Entity, error)

func (*MSRepo) GetID

func (er *MSRepo) GetID(entity dependency.Entity) (string, error)

GetID checks identity of given entity from the middleware

func (*MSRepo) Transaction

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

func (*MSRepo) Update

func (er *MSRepo) Update(entity dependency.Entity) error

Update updates data with given entity in the middleware

type MSService

type MSService struct {
	dependency.Repository
	Entities []dependency.Entity
}

func NewMSService

func NewMSService(repo dependency.Repository) *MSService

NewMSService returns a new *MSService

func NewMSServiceWithDefault

func NewMSServiceWithDefault() *MSService

NewMSServiceWithDefault returns a new *MSService with default repository

func (*MSService) Create

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

Create creates a new monitor system entity and insert it into the middleware

func (*MSService) Delete

func (es *MSService) Delete(id string) error

Delete deletes the monitor system entity that contains the given id in the middleware

func (*MSService) GetAll

func (es *MSService) GetAll() error

GetAll gets all monitor system entities from the middleware

func (*MSService) GetByID

func (es *MSService) GetByID(id string) error

GetByID gets an monitor system entity that contains the given id from the middleware

func (*MSService) GetEntities

func (es *MSService) GetEntities() []dependency.Entity

GetEntities returns entities of the service

func (*MSService) Marshal

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

Marshal marshals service.Entities

func (*MSService) MarshalWithFields

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

Marshal marshals service.Entities with given fields

func (*MSService) Update

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

Update gets an monitor system 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 MYSQLClusterInfo

type MYSQLClusterInfo struct {
	dependency.Repository
	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"`
	OwnerID             int       `middleware:"owner_id" json:"owner_id"`
	OwnerGroup          string    `middleware:"owner_group" json:"owner_group"`
	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 NewEmptyMYSQLClusterInfoWithGlobal

func NewEmptyMYSQLClusterInfoWithGlobal() *MYSQLClusterInfo

NewEmptyMYSQLClusterInfoWithGlobal returns a new MYSQLClusterInfo with default MYSQLClusterRepo

func NewMYSQLClusterInfo

func NewMYSQLClusterInfo(repo *MYSQLClusterRepo,
	id int,
	clusterName string,
	middlewareClusterID int,
	monitorSystemID int,
	ownerID int, ownerGroup string,
	envID int,
	delFlag int,
	createTime, lastUpdateTime time.Time) *MYSQLClusterInfo

NewMYSQLClusterInfo returns a new MYSQLClusterInfo

func NewMYSQLClusterInfoWithDefault

func NewMYSQLClusterInfoWithDefault(clusterName string) *MYSQLClusterInfo

NewMYSQLClusterInfoWithDefault returns a new MYSQLClusterInfo with default MYSQLClusterRepo

func NewMYSQLClusterInfoWithGlobal

func NewMYSQLClusterInfoWithGlobal(
	id int,
	clusterName string,
	middlewareClusterID int,
	monitorSystemID int,
	ownerID int, ownerGroup string,
	envID int,
	delFlag int,
	createTime, lastUpdateTime time.Time) *MYSQLClusterInfo

NewMYSQLClusterInfoWithGlobal returns a new MYSQLClusterInfo with default MYSQLClusterRepo

func (*MYSQLClusterInfo) Delete

func (mci *MYSQLClusterInfo) Delete()

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

func (*MYSQLClusterInfo) Get

func (mci *MYSQLClusterInfo) Get(field string) (interface{}, error)

Get returns value of given field

func (*MYSQLClusterInfo) GetCreateTime

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

GetCreateTime returns created time of entity

func (*MYSQLClusterInfo) GetLastUpdateTime

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

GetLastUpdateTime returns last updated time of entity

func (*MYSQLClusterInfo) Identity

func (mci *MYSQLClusterInfo) Identity() string

Identity returns ID of entity

func (*MYSQLClusterInfo) IsDeleted

func (mci *MYSQLClusterInfo) IsDeleted() bool

IsDeleted checks if delete flag had been set

func (*MYSQLClusterInfo) MarshalJSON

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

MarshalJSON marshals entity 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 entity to json string

func (*MYSQLClusterInfo) Set

func (mci *MYSQLClusterInfo) 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 MYSQLClusterRepo

type MYSQLClusterRepo struct {
	Database middleware.Pool
}

MYSQLClusterRepo implements Repository interface

func NewMYSQLClusterRepo

func NewMYSQLClusterRepo(db middleware.Pool) *MYSQLClusterRepo

NewMYSQLClusterRepo returns *MYSQLClusterRepo with given middleware.Pool

func NewMYSQLClusterRepoWithGlobal

func NewMYSQLClusterRepoWithGlobal() *MYSQLClusterRepo

NewMYSQLClusterRepoWithGlobal returns *MYSQLClusterRepo with global mysql pool

func (*MYSQLClusterRepo) Create

func (er *MYSQLClusterRepo) Create(entity dependency.Entity) (dependency.Entity, error)

Create creates data with given entity in the middleware

func (*MYSQLClusterRepo) Delete

func (er *MYSQLClusterRepo) Delete(id string) error

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

func (*MYSQLClusterRepo) Execute

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

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

func (*MYSQLClusterRepo) GetAll

func (er *MYSQLClusterRepo) GetAll() ([]dependency.Entity, error)

GetAll returns all available entities

func (*MYSQLClusterRepo) GetByID

func (er *MYSQLClusterRepo) GetByID(id string) (dependency.Entity, error)

GetByID Select returns an available entity of the given id

func (*MYSQLClusterRepo) GetID

func (er *MYSQLClusterRepo) GetID(entity dependency.Entity) (string, error)

GetID checks identity of given entity from the middleware

func (*MYSQLClusterRepo) Transaction

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

Transaction returns middleware.PoolConn

func (*MYSQLClusterRepo) Update

func (er *MYSQLClusterRepo) Update(entity dependency.Entity) error

Update updates data with given entity in the middleware

type MYSQLClusterService

type MYSQLClusterService struct {
	dependency.Repository
	Entities []dependency.Entity
}

MYSQLClusterService implements Service interface

func NewMYSQLClusterService

func NewMYSQLClusterService(repo dependency.Repository) *MYSQLClusterService

NewMYSQLClusterService returns a new *MYSQLClusterService

func NewMYSQLClusterServiceWithDefault

func NewMYSQLClusterServiceWithDefault() *MYSQLClusterService

NewMYSQLClusterServiceWithDefault returns a new *MYSQLClusterService with default repository

func (*MYSQLClusterService) Create

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

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

func (*MYSQLClusterService) Delete

func (es *MYSQLClusterService) Delete(id string) error

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

func (*MYSQLClusterService) GetAll

func (es *MYSQLClusterService) GetAll() error

GetAll gets all environment entities from the middleware

func (*MYSQLClusterService) GetByID

func (es *MYSQLClusterService) GetByID(id string) error

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

func (*MYSQLClusterService) GetEntities

func (es *MYSQLClusterService) GetEntities() []dependency.Entity

GetEntities returns entities of the service

func (*MYSQLClusterService) Marshal

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

Marshal marshals service.Entities

func (*MYSQLClusterService) MarshalWithFields

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

MarshalWithFields marshals service.Entities with given fields

func (*MYSQLClusterService) Update

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

Update gets an environment 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 {
	dependency.Repository
	ID             int       `middleware:"id" json:"id"`
	ClusterID      int       `middleware:"cluster_id" json:"cluster_id"`
	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 NewEmptyMYSQLServerInfoWithGlobal

func NewEmptyMYSQLServerInfoWithGlobal() *MYSQLServerInfo

NewEmptyMYSQLServerInfoWithGlobal returns a new MYSQLServerInfo with default MYSQLServerRepo

func NewMYSQLServerInfo

func NewMYSQLServerInfo(repo *MYSQLServerRepo,
	id int,
	clusterID int,
	hostIP string,
	portNum int,
	deploymentType int,
	version string,
	delFlag int,
	createTime, lastUpdateTime time.Time) *MYSQLServerInfo

NewMYSQLServerInfo returns a new MYSQLServerInfo

func NewMYSQLServerInfoWithDefault

func NewMYSQLServerInfoWithDefault(hostIP string, portNum int) *MYSQLServerInfo

NewMYSQLServerInfoWithDefault returns a new MYSQLServerInfo with default MYSQLServerRepo

func NewMYSQLServerInfoWithGlobal

func NewMYSQLServerInfoWithGlobal(
	id int,
	clusterID int,
	hostIP string,
	portNum int,
	deploymentType int,
	version string,
	delFlag int,
	createTime, lastUpdateTime time.Time) *MYSQLServerInfo

NewMYSQLServerInfoWithGlobal returns a new MYSQLServerInfo with default MYSQLServerRepo

func (*MYSQLServerInfo) Delete

func (mci *MYSQLServerInfo) Delete()

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

func (*MYSQLServerInfo) Get

func (mci *MYSQLServerInfo) Get(field string) (interface{}, error)

Get returns value of given field

func (*MYSQLServerInfo) GetCreateTime

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

GetCreateTime returns created time of entity

func (*MYSQLServerInfo) GetLastUpdateTime

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

GetLastUpdateTime returns last updated time of entity

func (*MYSQLServerInfo) Identity

func (mci *MYSQLServerInfo) Identity() string

Identity returns ID of entity

func (*MYSQLServerInfo) IsDeleted

func (mci *MYSQLServerInfo) IsDeleted() bool

IsDeleted checks if delete flag had been set

func (*MYSQLServerInfo) MarshalJSON

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

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

func (*MYSQLServerInfo) MarshalJSONWithFields

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

MarshalJSONWithFields marshals only with specified fields of entity to json string

func (*MYSQLServerInfo) Set

func (mci *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 Repository interface

func NewMYSQLServerRepo

func NewMYSQLServerRepo(db middleware.Pool) *MYSQLServerRepo

NewMYSQLServerRepo returns *MYSQLServerRepo with given middleware.Pool

func NewMYSQLServerRepoWithGlobal

func NewMYSQLServerRepoWithGlobal() *MYSQLServerRepo

NewMYSQLServerRepoWithGlobal returns *MYSQLServerRepo with global mysql pool

func (*MYSQLServerRepo) Create

func (er *MYSQLServerRepo) Create(entity dependency.Entity) (dependency.Entity, error)

Create creates data with given entity in the middleware

func (*MYSQLServerRepo) Delete

func (er *MYSQLServerRepo) Delete(id string) error

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

func (*MYSQLServerRepo) Execute

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

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

func (*MYSQLServerRepo) GetAll

func (er *MYSQLServerRepo) GetAll() ([]dependency.Entity, error)

GetAll returns all available entities

func (*MYSQLServerRepo) GetByID

func (er *MYSQLServerRepo) GetByID(id string) (dependency.Entity, error)

GetByID Select returns an available entity of the given id

func (*MYSQLServerRepo) GetID

func (er *MYSQLServerRepo) GetID(entity dependency.Entity) (string, error)

GetID checks identity of given entity from the middleware

func (*MYSQLServerRepo) Transaction

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

Transaction returns middleware.PoolConn

func (*MYSQLServerRepo) Update

func (er *MYSQLServerRepo) Update(entity dependency.Entity) error

Update updates data with given entity in the middleware

type MYSQLServerService

type MYSQLServerService struct {
	dependency.Repository
	Entities []dependency.Entity
}

MYSQLServerService implements Service interface

func NewMYSQLServerService

func NewMYSQLServerService(repo dependency.Repository) *MYSQLServerService

NewMYSQLServerService returns a new *MYSQLServerService

func NewMYSQLServerServiceWithDefault

func NewMYSQLServerServiceWithDefault() *MYSQLServerService

NewMYSQLServerServiceWithDefault returns a new *MYSQLServerService with default repository

func (*MYSQLServerService) Create

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

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

func (*MYSQLServerService) Delete

func (es *MYSQLServerService) Delete(id string) error

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

func (*MYSQLServerService) GetAll

func (es *MYSQLServerService) GetAll() error

GetAll gets all environment entities from the middleware

func (*MYSQLServerService) GetByID

func (es *MYSQLServerService) GetByID(id string) error

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

func (*MYSQLServerService) GetEntities

func (es *MYSQLServerService) GetEntities() []dependency.Entity

GetEntities returns entities of the service

func (*MYSQLServerService) Marshal

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

Marshal marshals service.Entities

func (*MYSQLServerService) MarshalWithFields

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

MarshalWithFields marshals service.Entities with given fields

func (*MYSQLServerService) Update

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

Update gets an environment 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 MiddlewareClusterInfo

type MiddlewareClusterInfo struct {
	dependency.Repository
	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 NewEmptyMiddlewareClusterInfoWithGlobal

func NewEmptyMiddlewareClusterInfoWithGlobal() *MiddlewareClusterInfo

func NewMiddlewareClusterInfo

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

NewMiddlewareClusterInfo returns a new MiddlewareClusterInfo

func NewMiddlewareClusterInfoWithDefault

func NewMiddlewareClusterInfoWithDefault(middlewareClusterName string, envID int) *MiddlewareClusterInfo

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) *MiddlewareClusterInfo

NewMiddlewareClusterInfo returns a new MiddlewareClusterInfo with default MiddlewareClusterRepo

func NewMiddlewareClusterInfoWithMapAndRandom

func NewMiddlewareClusterInfoWithMapAndRandom(fields map[string]interface{}) (*MiddlewareClusterInfo, error)

NewMiddlewareClusterInfoWithMapAndRandom returns a new *MiddlewareClusterInfoInfo with given map

func (*MiddlewareClusterInfo) Delete

func (mci *MiddlewareClusterInfo) Delete()

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

func (*MiddlewareClusterInfo) Get

func (mci *MiddlewareClusterInfo) Get(field string) (interface{}, error)

Get returns value of given field

func (*MiddlewareClusterInfo) GetCreateTime

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

GetCreateTime returns created time of entity

func (*MiddlewareClusterInfo) GetLastUpdateTime

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

GetLastUpdateTime returns last updated time of entity

func (*MiddlewareClusterInfo) Identity

func (mci *MiddlewareClusterInfo) Identity() string

Identity returns ID of entity

func (*MiddlewareClusterInfo) IsDeleted

func (mci *MiddlewareClusterInfo) IsDeleted() bool

IsDeleted checks if delete flag had been set

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 NewMiddlewareClusterRepo

func NewMiddlewareClusterRepo(db middleware.Pool) *MiddlewareClusterRepo

NewMiddlewareClusterRepo returns *MiddlewareClusterRepo with given middleware.Pool

func NewMiddlewareClusterRepoWithGlobal

func NewMiddlewareClusterRepoWithGlobal() *MiddlewareClusterRepo

NewMiddlewareClusterRepo returns *MiddlewareClusterRepo with global mysql pool

func (*MiddlewareClusterRepo) Create

Create creates data with given entity in the middleware

func (*MiddlewareClusterRepo) Delete

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

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

func (*MiddlewareClusterRepo) Execute

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

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

func (*MiddlewareClusterRepo) GetAll

func (mcr *MiddlewareClusterRepo) GetAll() ([]dependency.Entity, error)

GetAll returns all available entities

func (*MiddlewareClusterRepo) GetByID

func (mcr *MiddlewareClusterRepo) GetByID(id string) (dependency.Entity, error)

func (*MiddlewareClusterRepo) GetID

func (mcr *MiddlewareClusterRepo) GetID(entity dependency.Entity) (string, error)

GetID checks identity of given entity from the middleware

func (*MiddlewareClusterRepo) Transaction

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

func (*MiddlewareClusterRepo) Update

func (mcr *MiddlewareClusterRepo) Update(entity dependency.Entity) error

Update updates data with given entity in the middleware

type MiddlewareClusterService

type MiddlewareClusterService struct {
	dependency.Repository
	Entities []dependency.Entity
}

func NewMiddlewareClusterService

func NewMiddlewareClusterService(repo dependency.Repository) *MiddlewareClusterService

NewMiddlewareClusterService returns a new *MiddlewareClusterService

func NewMiddlewareClusterServiceWithDefault

func NewMiddlewareClusterServiceWithDefault() *MiddlewareClusterService

NewMiddlewareClusterServiceWithDefault returns a new *MiddlewareClusterService with default repository

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 string) error

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

func (*MiddlewareClusterService) GetAll

func (mcs *MiddlewareClusterService) GetAll() error

GetAll gets all middleware cluster entities from the middleware

func (*MiddlewareClusterService) GetByID

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

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

func (*MiddlewareClusterService) GetEntities

func (mcs *MiddlewareClusterService) GetEntities() []dependency.Entity

GetEntities returns entities of the service

func (*MiddlewareClusterService) Marshal

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

Marshal marshals service.Entities

func (*MiddlewareClusterService) MarshalWithFields

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

Marshal marshals service.Entities with given fields

func (*MiddlewareClusterService) Update

func (mcs *MiddlewareClusterService) Update(id string, 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 {
	dependency.Repository
	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 NewEmptyMiddlewareServerInfoWithGlobal

func NewEmptyMiddlewareServerInfoWithGlobal() *MiddlewareServerInfo

func NewMiddlewareServerInfo

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

NewMiddlewareServerInfo returns a new MiddlewareServerInfo

func NewMiddlewareServerInfoWithDefault

func NewMiddlewareServerInfoWithDefault(clusterID int, serverName string, middlewareRole int, hostIP string, portNum int) *MiddlewareServerInfo

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) *MiddlewareServerInfo

NewMiddlewareServerInfo returns a new MiddlewareServerInfo with default MiddlewareServerRepo

func NewMiddlewareServerInfoWithMapAndRandom

func NewMiddlewareServerInfoWithMapAndRandom(fields map[string]interface{}) (*MiddlewareServerInfo, error)

NewMiddlewareServerInfoWithMapAndRandom returns a new *MiddlewareServerInfo with given map

func (*MiddlewareServerInfo) Delete

func (msi *MiddlewareServerInfo) Delete()

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

func (*MiddlewareServerInfo) Get

func (msi *MiddlewareServerInfo) Get(field string) (interface{}, error)

Get returns value of given field

func (*MiddlewareServerInfo) GetCreateTime

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

GetCreateTime returns created time of entity

func (*MiddlewareServerInfo) GetLastUpdateTime

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

GetLastUpdateTime returns last updated time of entity

func (*MiddlewareServerInfo) Identity

func (msi *MiddlewareServerInfo) Identity() string

Identity returns ID of entity

func (*MiddlewareServerInfo) IsDeleted

func (msi *MiddlewareServerInfo) IsDeleted() bool

IsDeleted checks if delete flag had been set

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 NewMiddlewareServerRepo

func NewMiddlewareServerRepo(db middleware.Pool) *MiddlewareServerRepo

NewMiddlewareServerRepo returns *MiddlewareServerRepo with given middleware.Pool

func NewMiddlewareServerRepoWithGlobal

func NewMiddlewareServerRepoWithGlobal() *MiddlewareServerRepo

NewMiddlewareServerRepo returns *MiddlewareServerRepo with global mysql pool

func (*MiddlewareServerRepo) Create

Create creates data with given entity in the middleware

func (*MiddlewareServerRepo) Delete

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

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

func (*MiddlewareServerRepo) Execute

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

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

func (*MiddlewareServerRepo) GetAll

func (msr *MiddlewareServerRepo) GetAll() ([]dependency.Entity, error)

GetAll returns all available entities

func (*MiddlewareServerRepo) GetByID

func (msr *MiddlewareServerRepo) GetByID(id string) (dependency.Entity, error)

func (*MiddlewareServerRepo) GetID

func (msr *MiddlewareServerRepo) GetID(entity dependency.Entity) (string, error)

GetID checks identity of given entity from the middleware

func (*MiddlewareServerRepo) Transaction

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

func (*MiddlewareServerRepo) Update

func (msr *MiddlewareServerRepo) Update(entity dependency.Entity) error

Update updates data with given entity in the middleware

type MiddlewareServerService

type MiddlewareServerService struct {
	dependency.Repository
	Entities []dependency.Entity
}

func NewMiddlewareServerService

func NewMiddlewareServerService(repo dependency.Repository) *MiddlewareServerService

NewMiddlewareServerService returns a new *MiddlewareServerService

func NewMiddlewareServerServiceWithDefault

func NewMiddlewareServerServiceWithDefault() *MiddlewareServerService

NewMiddlewareServerServiceWithDefault returns a new *MiddlewareServerService with default repository

func (*MiddlewareServerService) Create

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

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

func (*MiddlewareServerService) Delete

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

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

func (*MiddlewareServerService) GetAll

func (mss *MiddlewareServerService) GetAll() error

GetAll gets all middlewareServerEnvironment entities from the middleware

func (*MiddlewareServerService) GetByID

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

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

func (*MiddlewareServerService) GetEntities

func (mss *MiddlewareServerService) GetEntities() []dependency.Entity

GetEntities returns entities of the service

func (*MiddlewareServerService) Marshal

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

Marshal marshals service.Entities

func (*MiddlewareServerService) MarshalWithFields

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

Marshal marshals service.Entities with given fields

func (*MiddlewareServerService) Update

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

Update gets an middleware ServerEnvironment 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 UserInfo

type UserInfo struct {
	dependency.Repository
	ID             int       `middleware:"id" json:"id"`
	UserName       string    `middleware:"user_name" json:"user_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"`
	DepartmentName string    `middleware:"department_name" json:"department_name"`
	EmployeeID     int       `middleware:"employee_id" json:"employee_id"`
	DomainAccount  string    `middleware:"domain_account" json:"domain_account"`
	Email          string    `middleware:"email" json:"email"`
	Telephone      string    `middleware:"telephone" json:"telephone"`
	Mobile         string    `middleware:"mobile" json:"mobile"`
	Role           int       `middleware:"role" json:"role"`
}

func NewEmptyUserInfoWithGlobal

func NewEmptyUserInfoWithGlobal() *UserInfo

func NewUserInfo

func NewUserInfo(repo *UserRepo, id int, userName string, delFlag int, createTime time.Time, lastUpdateTime time.Time, departmentName string, employeeID int, domainAccount string, email string, telephone string, mobile string, role int) *UserInfo

NewUserInfo returns a new UserInfo

func NewUserInfoWithDefault

func NewUserInfoWithDefault(userName string, departmentName string, employeeID int, domainAccount string, email string, telephone string, mobile string, role int) *UserInfo

NewUserInfoWithDefault returns a new UserInfo with default UserRepo

func NewUserInfoWithGlobal

func NewUserInfoWithGlobal(id int, userName string, delFlag int, createTime time.Time, lastUpdateTime time.Time, departmentName string, employeeID int, domainAccount string, email string, telephone string, mobile string, role int) *UserInfo

NewUserInfo returns a new UserInfo with default UserRepo

func (*UserInfo) Delete

func (ui *UserInfo) Delete()

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

func (*UserInfo) Get

func (ui *UserInfo) Get(field string) (interface{}, error)

Get returns value of given field

func (*UserInfo) GetCreateTime

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

GetCreateTime returns created time of entity

func (*UserInfo) GetDepartmentName

func (ui *UserInfo) GetDepartmentName() string

GetDepartmentName returns last updated time of entity

func (*UserInfo) GetDomainAccount

func (ui *UserInfo) GetDomainAccount() string

GetDomainAccount returns last updated time of entity

func (*UserInfo) GetEmail

func (ui *UserInfo) GetEmail() string

GetEmail returns last updated time of entity

func (*UserInfo) GetEmployeeID

func (ui *UserInfo) GetEmployeeID() int

GetEmployeeID returns last updated time of entity

func (*UserInfo) GetLastUpdateTime

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

GetLastUpdateTime returns last updated time of entity

func (*UserInfo) GetRole

func (ui *UserInfo) GetRole() int

GetRole returns last updated time of entity

func (*UserInfo) GetTelephone

func (ui *UserInfo) GetTelephone() string

GetTelephone returns last updated time of entity

func (*UserInfo) Identity

func (ui *UserInfo) Identity() string

Identity returns ID of entity

func (*UserInfo) IsDeleted

func (ui *UserInfo) IsDeleted() bool

IsDeleted checks if delete flag had been set

func (*UserInfo) MarshalJSON

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

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

func (*UserInfo) MarshalJSONWithFields

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

MarshalJSONWithFields marshals only with specified fields of entity 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
}

func NewUserRepo

func NewUserRepo(db middleware.Pool) *UserRepo

NewUserRepo returns *UserRepo with given middleware.Pool

func NewUserRepoWithGlobal

func NewUserRepoWithGlobal() *UserRepo

NewUserRepo returns *UserRepo with global mysql pool

func (*UserRepo) Create

func (ur *UserRepo) Create(entity dependency.Entity) (dependency.Entity, error)

Create creates data with given entity in the middleware

func (*UserRepo) Delete

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

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

func (*UserRepo) Execute

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

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

func (*UserRepo) GetAll

func (ur *UserRepo) GetAll() ([]dependency.Entity, error)

GetAll returns all available entities

func (*UserRepo) GetByID

func (ur *UserRepo) GetByID(id string) (dependency.Entity, error)

func (*UserRepo) GetID

func (ur *UserRepo) GetID(entity dependency.Entity) (string, error)

GetID checks identity of given entity from the middleware

func (*UserRepo) Transaction

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

func (*UserRepo) Update

func (ur *UserRepo) Update(entity dependency.Entity) error

Update updates data with given entity in the middleware

type UserService

type UserService struct {
	dependency.Repository
	Entities []dependency.Entity
}

func NewUserService

func NewUserService(repo dependency.Repository) *UserService

NewUserService returns a new *UserService

func NewUserServiceWithDefault

func NewUserServiceWithDefault() *UserService

NewUserServiceWithDefault returns a new *UserService with default repository

func (*UserService) Create

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

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

func (*UserService) Delete

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

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

func (*UserService) GetAll

func (us *UserService) GetAll() error

GetAll gets all Userironment entities from the middleware

func (*UserService) GetByID

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

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

func (*UserService) GetEntities

func (us *UserService) GetEntities() []dependency.Entity

GetEntities returns entities of the service

func (*UserService) Marshal

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

Marshal marshals service.Entities

func (*UserService) MarshalWithFields

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

Marshal marshals service.Entities with given fields

func (*UserService) Update

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

Update gets an Userironment 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

Jump to

Keyboard shortcuts

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