mysql

package
v0.0.0-...-f13fc7a Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)

Functions

func BuildDBM

func BuildDBM(address string, user string, password string, dbName string) (*gorm.DB, error)

func ConvertConfigType

func ConvertConfigType(Type string) int64

func GetAttribute

func GetAttribute(class interface{}, attrName string) (interface{}, error)

func InitDB

func InitDB() (err error)

func NewUserEmail

func NewUserEmail(appUUID, instanceUUID string) string

func NewUserUUID

func NewUserUUID(appUUID, instanceUUID string) string

func SetAttribute

func SetAttribute(class interface{}, attrName string, attrValue interface{}) error

func Transaction

func Transaction(callback func(db *gorm.DB) error) error

Types

type AppInstanceCount

type AppInstanceCount struct {
	AppId string
	Num   int64
}

func (*AppInstanceCount) String

func (b *AppInstanceCount) String() string

type BaseModel

type BaseModel struct {
	Id         int64      `gorm:"id" json:"id"`
	CreateTime int64      `gorm:"create_time" json:"create_time"`
	UpdateTime int64      `gorm:"update_time" json:"update_time"`
	Deleted    bool       `gorm:"deleted" json:"deleted"`
	Child      ModelInter `gorm:"-" json:"-"`
}

func (*BaseModel) All

func (bm *BaseModel) All(out interface{}, arg ModelInter) error

func (*BaseModel) Delete

func (bm *BaseModel) Delete(id int64, arg ModelInter) error

func (*BaseModel) DeleteWithDB

func (bm *BaseModel) DeleteWithDB(db *gorm.DB, id int64, arg ModelInter) error

func (*BaseModel) Exist

func (bm *BaseModel) Exist(arg ModelInter) (bool, error)

func (*BaseModel) New

func (bm *BaseModel) New(out ModelInter) error

func (*BaseModel) NewBatch

func (bm *BaseModel) NewBatch(data interface{}) error

func (*BaseModel) NewBatchWithDB

func (bm *BaseModel) NewBatchWithDB(db *gorm.DB, data interface{}) error

func (*BaseModel) NewWithDB

func (bm *BaseModel) NewWithDB(db *gorm.DB, out ModelInter) error

func (*BaseModel) One

func (bm *BaseModel) One(out ModelInter) error

func (*BaseModel) RealDelete

func (bm *BaseModel) RealDelete(id int64, arg ModelInter) error

func (*BaseModel) RealDeleteWithDB

func (bm *BaseModel) RealDeleteWithDB(db *gorm.DB, id int64, arg ModelInter) error

func (*BaseModel) Save

func (bm *BaseModel) Save(arg ModelInter) error

func (*BaseModel) String

func (bm *BaseModel) String() string

func (*BaseModel) Update

func (bm *BaseModel) Update(id int64, arg ModelInter) error

func (*BaseModel) UpdateWithDB

func (bm *BaseModel) UpdateWithDB(db *gorm.DB, id int64, arg ModelInter) error

type ModelInter

type ModelInter interface {
	New(ModelInter) error
	NewBatch(interface{}) error
	One(ModelInter) error
	All(interface{}, ModelInter) error
	Update(int64, ModelInter) error
	Delete(int64, ModelInter) error
	Save(arg ModelInter) error
	// contains filtered or unexported methods
}

type PluginConfig

type PluginConfig struct {
	BaseModel
	AppUUID      string `gorm:"app_uuid" json:"app_uuid"`
	InstanceUUID string `gorm:"instance_uuid" json:"instance_uuid"`
	Label        string `gorm:"label" json:"label"`
	Key          string `gorm:"arg_key" json:"arg_key"`
	Value        string `gorm:"arg_value" json:"arg_value"`
	Type         int64  `gorm:"type" json:"type"` // COMBO: 1,INPUT: 2, TEXT: 3, SELECT: 4,CHECKBOX: 5,BUTTON: 6,
	Required     bool   `gorm:"required" json:"required"`
}

func ModelPluginConfig

func ModelPluginConfig() *PluginConfig

func (*PluginConfig) Uninstall

func (c *PluginConfig) Uninstall(db *gorm.DB, appId string, instanceId string) error

type PluginEvent

type PluginEvent struct {
	BaseModel
	Action   string `gorm:"action" json:"action"`
	Extended string `gorm:"extended" json:"extended"`
}

func GetEvents

func GetEvents() ([]*PluginEvent, error)

func ModelPluginEvent

func ModelPluginEvent() *PluginEvent

type PluginInstance

type PluginInstance struct {
	BaseModel
	AppUUID      string `gorm:"app_uuid" json:"app_uuid"`
	InstanceUUID string `gorm:"instance_uuid" json:"instance_uuid"`
	Name         string `gorm:"name" json:"name"`
	Version      string `gorm:"version" json:"version"`
	Description  string `gorm:"description" json:"description"`
	Contact      string `gorm:"contact" json:"contact"`
	Status       int    `gorm:"status" json:"status"`
	Apis         string `gorm:"apis" json:"apis"`
}

func ModelPluginInstance

func ModelPluginInstance() *PluginInstance

func (*PluginInstance) FirstInstance

func (i *PluginInstance) FirstInstance(appId string) (*PluginInstance, error)

func (*PluginInstance) GetConfig

func (i *PluginInstance) GetConfig() *types.PluginConfig

func (*PluginInstance) GetExcludeStartInstanceList

func (i *PluginInstance) GetExcludeStartInstanceList() ([]*PluginInstance, error)

获取除启用状态外的所有插件实例ID

func (*PluginInstance) GetOnePluginInstance

func (i *PluginInstance) GetOnePluginInstance(orgUUID, teamUUID, appUUID, instanceUUID string) ([]*PluginInstance, error)

func (*PluginInstance) GroupByAppId

func (i *PluginInstance) GroupByAppId() ([]*AppInstanceCount, error)

func (*PluginInstance) LoadYamlConfig

func (i *PluginInstance) LoadYamlConfig() (*types.PluginConfig, error)

func (*PluginInstance) RealDeleteWithDBArg

func (i *PluginInstance) RealDeleteWithDBArg(db *gorm.DB, arg ModelInter) error

type PluginPermissionInfo

type PluginPermissionInfo struct {
	BaseModel
	InstanceUUID    string `gorm:"instance_uuid" json:"instance_uuid"`
	PermissionName  string `gorm:"permission_name" json:"permission_name"`
	PermissionField string `gorm:"permission_field" json:"permission_field"`
	PermissionDesc  string `gorm:"permission_desc" json:"permission_desc"`
	PermissionID    int    `gorm:"permission_id" json:"permission_id"`
}

func ModelPluginPermissionInfo

func ModelPluginPermissionInfo() *PluginPermissionInfo

type PluginUser

type PluginUser struct {
	BaseModel
	UserUUID     string `gorm:"user_uuid" json:"user_uuid"`
	AppUUID      string `gorm:"app_uuid" json:"app_uuid"`
	InstanceUUID string `gorm:"instance_uuid" json:"instance_uuid"`
	Name         string `gorm:"name" json:"name"`
	Email        string `gorm:"email" json:"email"`
}

func ModelPluginUser

func ModelPluginUser() *PluginUser

func (*PluginUser) Uninstall

func (u *PluginUser) Uninstall(db *gorm.DB, appId string, instanceId string) error

Jump to

Keyboard shortcuts

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