orm

package
v1.3.0-rc.0...-0a48220 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OAUTH2       = "oauth2"
	KEYAUTH      = "key-auth"
	SIGNAUTH     = "sign-auth"
	HMACAUTH     = "hmac-auth"
	KeyAuthTips  = "请将appKey带在名为appKey的url参数或者名为X-App-Key的请求头上"
	SignAuthTips = "请将appKey带在名为appKey的url参数上,将参数签名串带在名为sign的url参数上"
	MSEBasicAuth = "basic-auth"
	MSEJWTAuth   = "jwt-auth"
)
View Source
const (
	AT_K8S     = "k8s"
	AT_DCOS    = "dcos"
	AT_EDAS    = "edas"
	AT_UNKNOWN = "unknown"
)
View Source
const (
	POLICY_PROJECT_LEVEL = "project" //已废弃
	POLICY_PACKAGE_LEVEL = "package"
)
View Source
const (
	DT_SERVICE_DEFAULT = "service_default"
	DT_SERVICE_CUSTOM  = "service_custom"
	DT_PACKAGE         = "package"
	DT_COMPONENT       = "component"
)
View Source
const (
	OpenapiScene = "openapi"
	WebapiScene  = "webapi"
	UnityScene   = "unity"
	HubScene     = "hub"
)
View Source
const (
	APIM_CLIENT_CONSUMER string = "apim_client"
)

Variables

This section is empty.

Functions

func BuildConds

func BuildConds(ormEngine *OrmEngine, bean interface{}, mustColumnMap map[string]bool) (builder.Cond, error)

func Count

func Count(engine xorm.Interface, row BaseAbility, cond interface{}, condArgs ...interface{}) (int64, error)

func CountWithOption

func CountWithOption(options []SelectOption, engine xorm.Interface, row BaseAbility) (int64, error)

func Delete

func Delete(engine xorm.Interface, row BaseAbility, cond interface{}, condArgs ...interface{}) (int64, error)

func DeleteByAnyI

func DeleteByAnyI(engine xorm.Interface, bCond builder.Cond, row BaseAbility) (int64, error)

func Desc

func Desc(engine xorm.Interface, colName string) *xorm.Session

func Distinct

func Distinct(engine xorm.Interface, cols []string, condAndArgs ...interface{}) (*xorm.Session, error)

func Get

func Get(engine xorm.Interface, row BaseAbility, cond interface{}, condArgs ...interface{}) (bool, error)

func GetByAny

func GetByAny(engine *OrmEngine, row BaseAbility, cond BaseAbility) (bool, error)

func GetByAnyI

func GetByAnyI(engine xorm.Interface, bCond builder.Cond, row BaseAbility) (bool, error)

func GetForUpdate

func GetForUpdate(session *xorm.Session, engine *OrmEngine, row BaseAbility, cond string, condArgs ...interface{}) (bool, error)

func GetRawByAnyI

func GetRawByAnyI(engine xorm.Interface, bCond builder.Cond, row BaseAbility) (bool, error)

func In

func In(engine xorm.Interface, colName string, colValues interface{}) *xorm.Session

func Init

func Init()

func Insert

func Insert(engine xorm.Interface, rows BaseAbility) (int64, error)

func ParseSelectOptions

func ParseSelectOptions(options []SelectOption, engine xorm.Interface) xorm.Interface

func RealDelete

func RealDelete(engine xorm.Interface, row BaseAbility, cond interface{}, condArgs ...interface{}) (int64, error)

func Recover

func Recover(engine xorm.Interface, row BaseAbility, id string) (int64, error)

func RegisterSqlMap

func RegisterSqlMap(engine OrmEngineInterface, path string) error

func Select

func Select(engine xorm.Interface, rows interface{}, cond interface{}, condArgs ...interface{}) error

func SelectByAny

func SelectByAny(engine *OrmEngine, rows interface{}, cond BaseAbility, descColumn ...string) error

func SelectByAnyI

func SelectByAnyI(engine xorm.Interface, bCond builder.Cond, rows interface{}, descColumn ...string) error

func SelectNoCond

func SelectNoCond(engine xorm.Interface, rows interface{}) error

func SelectNoCondMissing

func SelectNoCondMissing(engine xorm.Interface, rows interface{}) error

func SelectPage

func SelectPage(engine xorm.Interface, rows interface{}, page *common.Page, cond interface{}, condArgs ...interface{}) error

func SelectPageByAny

func SelectPageByAny(engine *OrmEngine, rows interface{}, page *common.Page, cond BaseAbility, descColumn ...string) error

func SelectPageByAnyI

func SelectPageByAnyI(engine xorm.Interface, bCond builder.Cond, rows interface{}, page *common.Page, descColumn ...string) error

func SelectPageNoCond

func SelectPageNoCond(engine xorm.Interface, rows interface{}, page *common.Page) error

func SelectPageWithOption

func SelectPageWithOption(options []SelectOption, engine xorm.Interface, rows interface{}, page *common.Page) error

func SelectWithOption

func SelectWithOption(options []SelectOption, engine xorm.Interface, rows interface{}) error

func SetGlobalCacher

func SetGlobalCacher(engine OrmEngineInterface, expired time.Duration, size int)

func SetPrefix

func SetPrefix(engine OrmEngineInterface, prefix string) error

func Update

func Update(engine xorm.Interface, row BaseAbility, columns ...string) (int64, error)

Types

type AuthItem

type AuthItem struct {
	AuthType string                        `json:"authType"`
	AuthData providerDto.CredentialListDto `json:"authData"`
	AuthTips string                        `json:"authTips"`
}

func FromAuth

func FromAuth(item *pb.ConsumerAuthItem) AuthItem

func (AuthItem) ToAuth

func (item AuthItem) ToAuth() *pb.ConsumerAuthItem

type BaseAbility

type BaseAbility interface {
	SetDeleted()
	SetRecover()
	GetMustCondCols() map[string]bool
	GetPK() map[string]interface{}
}

type BaseRow

type BaseRow struct {
	Id         string    `json:"id" xorm:"not null pk default '' comment('唯一id') VARCHAR(32)"`
	IsDeleted  string    `json:"is_deleted" xorm:"not null default 'N' comment('逻辑删除') VARCHAR(1)"`
	CreateTime time.Time `json:"create_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') TIMESTAMP"`
	UpdateTime time.Time `json:"update_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"`
	// contains filtered or unexported fields
}

func (*BaseRow) BeforeInsert

func (row *BaseRow) BeforeInsert()

func (*BaseRow) BeforeUpdate

func (row *BaseRow) BeforeUpdate()

func (*BaseRow) GetMustCondCols

func (row *BaseRow) GetMustCondCols() map[string]bool

func (*BaseRow) GetPK

func (row *BaseRow) GetPK() map[string]interface{}

func (*BaseRow) SetDeleted

func (row *BaseRow) SetDeleted()

func (*BaseRow) SetMustCondCols

func (row *BaseRow) SetMustCondCols(cols ...string)

func (*BaseRow) SetRecover

func (row *BaseRow) SetRecover()

type ConsumerAuthConfig

type ConsumerAuthConfig struct {
	Auths []AuthItem `json:"auths"`
}

type EngineMode

type EngineMode int8
const (
	SingleMode EngineMode = 1 << iota
	ClusterMode
)

type GatewayApi

type GatewayApi struct {
	ZoneId           string `json:"zone_id" xorm:"default '' comment('所属的zone') VARCHAR(32)"`
	ConsumerId       string `json:"consumer_id" xorm:"not null default '' comment('消费者id') VARCHAR(32)"`
	ApiPath          string `json:"api_path" xorm:"not null default '' comment('api路径') VARCHAR(256)"`
	Method           string `json:"method" xorm:"not null default '' comment('方法') VARCHAR(128)"`
	RedirectAddr     string `json:"redirect_addr" xorm:"not null default '' comment('转发地址') VARCHAR(256)"`
	Description      string `json:"description" xorm:"comment('描述') VARCHAR(256)"`
	GroupId          string `json:"group_id" xorm:"not null default '' comment('服务Id') VARCHAR(32)"`
	Policies         string `json:"policies" xorm:"comment('策略配置') VARCHAR(1024)"`
	UpstreamApiId    string `json:"upstream_api_id" xorm:"not null default '' comment('对应的后端api') VARCHAR(32)"`
	DiceApp          string `json:"dice_app" xorm:"default '' comment('dice应用名') varchar(128)"`
	DiceService      string `json:"dice_service" xorm:"default '' comment('dice服务名') varchar(128)"`
	RegisterType     string `json:"register_type" xorm:"not null default 'auto' comment('注册类型') varchar(16)"`
	NetType          string `json:"net_type" xorm:"not null default 'outer' comment('网络类型') varchar(16)"`
	NeedAuth         int    `json:"need_auth" xorm:"not null default 0 comment('需要鉴权标识') TINYINT(1)"`
	RedirectType     string `json:"redirect_type" xorm:"not null default 'url' comment('转发类型') VARCHAR(32)"`
	RuntimeServiceId string `json:"runtime_service_id" xorm:"not null default '' comment('关联的service的id') VARCHAR(32)"`
	Swagger          []byte `json:"swagger" xorm:"comment('swagger文档') BLOB"`
	Domains          string `json:"domains" xorm:"not null default '' comment('gateway api 的域名列表, 逗号隔开') VARCHAR(1024)"`
	BaseRow          `xorm:"extends"`
}

type GatewayApiInPackage

type GatewayApiInPackage struct {
	DiceApiId string `json:"dice_api_id" xorm:"not null default '' comment('dice服务api的id') VARCHAR(32)"`
	PackageId string `json:"package_id" xorm:"not null default '' comment('产品包id') VARCHAR(32)"`
	ZoneId    string `json:"zone_id" xorm:"comment('所属的zone') VARCHAR(32)"`
	BaseRow   `xorm:"extends"`
}

type GatewayAzInfo

type GatewayAzInfo struct {
	Az             string `json:"az" xorm:"not null comment('集群名') VARCHAR(32)"`
	Env            string `json:"env" xorm:"not null comment('应用所属环境') VARCHAR(32)"`
	NeedUpdate     int    `json:"need_update" xorm:"default 1 comment('待更新标识') TINYINT(1)"`
	OrgId          string `json:"org_id" xorm:"not null comment('企业标识id') VARCHAR(32)"`
	ProjectId      string `json:"project_id" xorm:"not null comment('项目标识id') VARCHAR(32)"`
	Type           string `json:"type" xorm:"not null comment('集群类型') VARCHAR(16)"`
	WildcardDomain string `json:"wildcard_domain" xorm:"not null comment('集群泛域名') default '' VARCHAR(1024)"`
	MasterAddr     string `josn:"master_addr" xorm:"not null comment('集群管控地址') default '' VARCHAR(1024)"`
	BaseRow        `xorm:"extends"`
}

type GatewayConsumer

type GatewayConsumer struct {
	ClientId      string `json:"client_id" xorm:"not null default '' comment('对应的客户端id') unique VARCHAR(32)"`
	ConsumerId    string `json:"consumer_id" xorm:"not null default '' comment('消费者id') unique VARCHAR(128)"`
	ConsumerName  string `json:"consumer_name" xorm:"not null default '' comment('消费者名称') VARCHAR(128)"`
	Config        string `json:"config" xorm:"comment('配置信息,存放key等') VARCHAR(1024)"`
	Endpoint      string `json:"endpoint" xorm:"not null default '' comment('终端') VARCHAR(256)"`
	OrgId         string `json:"org_id" xorm:"not null VARCHAR(32)"`
	ProjectId     string `json:"project_id" xorm:"not null VARCHAR(32)"`
	Env           string `json:"env" xorm:"not null VARCHAR(32)"`
	Az            string `json:"az" xorm:"not null VARCHAR(32)"`
	Description   string `json:"description" xorm:"comment('备注') VARCHAR(256)"`
	Type          string `json:"type" xorm:"not null default 'project' comment('调用方类型') VARCHAR(16)"`
	CloudapiAppId string `json:"cloudapi_app_id" xorm:"not null default '' comment('阿里云API网关的app id') VARCHAR(128)"`
	BaseRow       `xorm:"extends"`
}

type GatewayConsumerApi

type GatewayConsumerApi struct {
	ConsumerId string `json:"consumer_id" xorm:"not null default '' comment('消费者id') VARCHAR(32)"`
	ApiId      string `json:"api_id" xorm:"not null default '' comment('apiId') VARCHAR(32)"`
	Policies   string `json:"policies" xorm:"comment('策略信息') VARCHAR(512)"`
	BaseRow    `xorm:"extends"`
}

type GatewayCredential

type GatewayCredential struct {
	ConsumerId   string `json:"consumer_id" xorm:"not null default '' comment('消费者id') unique VARCHAR(128)"`
	ConsumerName string `json:"consumer_name" xorm:"not null default '' comment('消费者名称') VARCHAR(128)"`
	PluginName   string `json:"plugin_name" xorm:"not null default '' comment('插件名称') VARCHAR(128)"`

	OrgName   string `json:"org_name" xorm:"not null default '' comment('组织 名称') VARCHAR(50)"`
	OrgId     string `json:"org_id" xorm:"not null comment('组织 ID') VARCHAR(32)"`
	ProjectId string `json:"project_id" xorm:"not null comment('项目 ID') VARCHAR(32)"`
	Env       string `json:"env" xorm:"not null comment('部署环境') VARCHAR(32)"`
	Az        string `json:"az" xorm:"not null comment('集群名称') VARCHAR(32)"`

	// key-auth、basic-auth and hmac-auth
	Key string `json:"key"  xorm:"auth_key not null default '' comment('hmac-auth 对应的 key') VARCHAR(128)"`

	// sign-auth, hmac-auth
	Secret string `json:"secret" xorm:"not null default '' comment('hmac-auth 对应的 secret') VARCHAR(128)"` // for hmac-auth only
	// hmac-auth
	Username string `json:"username" xorm:"not null default '' comment('用户名称') unique VARCHAR(128)"`

	// JWT-AUTH
	Issuer           string `json:"issuer" xorm:"not null default '' comment('jwt-auth 对应的 issuer') VARCHAR(128)"`                // for jwt-auth only
	Jwks             string `json:"jwks" xorm:"not null default '' comment('jwt-auth 对应的 jwks') VARCHAR(4096)"`                   // for jwt-auth only
	FromParams       string `json:"from_params"  xorm:"not null default 'access_token' comment('从指定的URL参数中抽取JWT') VARCHAR(1024)"` // for jwt-auth only   default: ["access_token"]
	FromCookies      string `json:"from_cookies" xorm:"not null default '-' comment('从指定的URL参数中抽取JWT') VARCHAR(4096)"`            // for jwt-auth only   default: -
	KeepToken        string `json:"keep_token" xorm:"not null default 'Y' comment('转发给后端时是否保留JWT') VARCHAR(1)"`
	ClockSkewSeconds string `` // for jwt-auth only   default: 60
	/* 147-byte string literal not displayed */

	// oauth2
	RedirectUrl string `json:"redirect_url" xorm:"oauth2_redirect_url not null default '' comment('oauth2 v1 转发 url') VARCHAR(1024)"`
	// v2
	RedirectUrls string `json:"redirect_urls" xorm:"oauth2_v2_redirect_urls not null default '' comment('oauth2 v2 转发 urls') VARCHAR(4096)"`
	Name         string `json:"name"  xorm:"oauth2_name not null default '' comment('OAuth2 名称') VARCHAR(128)"`
	ClientId     string `json:"client_id" xorm:"oauth2_client_id not null default '' comment('客户端ID') VARCHAR(128)"`
	ClientSecret string `json:"client_secret" xorm:"oauth2_client_secret not null default '' comment('客户端Secret') VARCHAR(128)"`

	BaseRow `xorm:"extends"`
}

网关 Credential 信息,用于 MSE Gateway 网关场景,存储调用方授权信息

type GatewayDefaultPolicy

type GatewayDefaultPolicy struct {
	Config    []byte `json:"config" xorm:"comment('具体配置') BLOB"`
	DiceApp   string `json:"dice_app" xorm:"default '' comment('dice应用名') VARCHAR(128)"`
	Level     string `json:"level" xorm:"not null comment('策略级别') VARCHAR(32)"`
	Name      string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(32)"`
	TenantId  string `json:"tenant_id" xorm:"not null default '' comment('租户id') VARCHAR(128)"`
	PackageId string `json:"package_id" xorm:"not null default '' comment('流量入口id') VARCHAR(32)"`
	BaseRow   `xorm:"extends"`
}

type GatewayDomain

type GatewayDomain struct {
	Domain           string `json:"domain" xorm:"not null comment('域名') index(idx_cluster_domain) VARCHAR(255)"`
	ClusterName      string `json:"cluster_name" xorm:"not null default '' comment('所属集群') index(idx_cluster_domain) VARCHAR(32)"`
	Type             string `json:"type" xorm:"not null comment('域名类型') VARCHAR(32)"`
	RuntimeServiceId string `json:"runtime_service_id" xorm:"comment('所属服务id') index(idx_runtime_service) VARCHAR(32)"`
	PackageId        string `json:"package_id" xorm:"comment('所属流量入口id') index(idx_package) VARCHAR(32)"`
	ComponentName    string `json:"component_name" xorm:"comment('所属平台组件的名称') VARCHAR(32)"`
	IngressName      string `json:"ingress_name" xorm:"comment('所属平台组件的ingress的名称') VARCHAR(32)"`
	OrgId            string `json:"org_id" xorm:"not null comment('组织标识id') VARCHAR(32)"`
	ProjectId        string `json:"project_id" xorm:"not null comment('项目标识id') VARCHAR(32)"`
	ProjectName      string `json:"project_name" xorm:"not null comment('项目名称') VARCHAR(50)"`
	Workspace        string `json:"workspace" xorm:"not null comment('所属环境') VARCHAR(32)"`
	BaseRow          `xorm:"extends"`
}

type GatewayExtra

type GatewayExtra struct {
	Field   string `json:"field" xorm:"not null default '' comment('域') index(key) VARCHAR(128)"`
	KeyId   string `json:"key_id" xorm:"not null default '' comment('键') index(key) VARCHAR(64)"`
	Value   string `json:"value" xorm:"not null default '' comment('值') VARCHAR(128)"`
	BaseRow `xorm:"extends"`
}

type GatewayGroup

type GatewayGroup struct {
	GroupName   string `json:"group_name" xorm:"not null default '' comment('组名') unique(group_consumer) VARCHAR(128)"`
	DispalyName string `json:"dispaly_name" xorm:"not null default '' comment('展示名称') VARCHAR(128)"`
	ConsumerId  string `json:"consumer_id" xorm:"not null default '' comment('所属消费者id') unique(group_consumer) VARCHAR(32)"`
	Policies    string `json:"policies" xorm:"comment('策略配置,存策略id') VARCHAR(1024)"`
	BaseRow     `xorm:"extends"`
}

func (GatewayGroup) IsEmpty

func (group GatewayGroup) IsEmpty() bool

type GatewayHubInfo

type GatewayHubInfo struct {
	OrgId           string `json:"org_id" xorm:"not null comment('dice企业标识id') VARCHAR(32)"`
	DiceEnv         string `json:"dice_env" xorm:"not null comment('dice环境') VARCHAR(32)"`
	DiceClusterName string `json:"dice_cluster_name" xorm:"not null comment('dice集群名') VARCHAR(32)"`
	BindDomain      string `json:"bind_domain" xorm:"comment('绑定的域名') VARCHAR(1024)"`
	Description     string `json:"description" xorm:"comment('描述') VARCHAR(256)"`
	BaseRow         `xorm:"extends"`
}

type GatewayIngressPolicy

type GatewayIngressPolicy struct {
	Name            string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(32)"`
	Regions         string `json:"regions" xorm:"not null default '' comment('作用域') VARCHAR(128)"`
	Az              string `json:"az" xorm:"not null comment('集群名') VARCHAR(32)"`
	ZoneId          string `json:"zone_id" xorm:"default null comment('所属的zone') VARCHAR(32)"`
	Config          []byte `json:"config" xorm:"comment('具体配置') BLOB"`
	ConfigmapOption []byte `json:"configmap_option" xorm:"comment('ingress configmap option') BLOB"`
	MainSnippet     []byte `json:"main_snippet" xorm:"comment('ingress configmap main 配置') BLOB"`
	HttpSnippet     []byte `json:"http_snippet" xorm:"comment('ingress configmap http 配置') BLOB"`
	ServerSnippet   []byte `json:"server_snippet" xorm:"comment('ingress configmap server 配置') BLOB"`
	Annotations     []byte `json:"annotations" xorm:"comment('包含的annotations') BLOB"`
	LocationSnippet []byte `json:"location_snippet" xorm:"comment('nginx location 配置') BLOB"`
	BaseRow         `xorm:"extends"`
}

type GatewayKongInfo

type GatewayKongInfo struct {
	Az              string `json:"az" xorm:"not null comment('集群名') VARCHAR(32)"`
	Env             string `json:"env" xorm:"default '' comment('环境名') VARCHAR(32)"`
	ProjectId       string `json:"project_id" xorm:"not null comment('项目id') VARCHAR(32)"`
	ProjectName     string `json:"project_name" xorm:"not null comment('项目名') VARCHAR(256)"`
	KongAddr        string `json:"kong_addr" xorm:"not null comment('kong admin地址') VARCHAR(256)"`
	Endpoint        string `json:"endpoint" xorm:"not null comment('kong gateway地址') VARCHAR(256)"`
	NeedUpdate      int    `json:"need_update" xorm:"default 1 comment('待更新标识') TINYINT(1)"`
	InnerAddr       string `json:"inner_addr" xorm:"not null default '' comment('kong内网地址') varchar(1024)"`
	ServiceName     string `josn:"service_name" xorm:"not null default '' comment('kong的服务名称') varchar(32)"`
	AddonInstanceId string `json:"addon_instance_id" xorm:"not null default '' comment('addon id') varchar(32)"`
	TenantId        string `json:"tenant_id" xorm:"not null default '' comment('租户id') VARCHAR(128)"`
	TenantGroup     string `json:"tenant_group" xorm:"not null default '' comment('租户分组') VARCHAR(128)"`
	BaseRow         `xorm:"extends"`
}

type GatewayMock

type GatewayMock struct {
	Az      string `json:"az" xorm:"VARCHAR(256)"`
	HeadKey string `json:"head_key" xorm:"not null pk VARCHAR(256)"`
	Body    string `json:"body" xorm:"TEXT"`
	Pathurl string `json:"pathurl" xorm:"not null pk VARCHAR(256)"`
	Method  string `json:"method" xorm:"VARCHAR(32)"`
	BaseRow `xorm:"extends"`
}

func (*GatewayMock) GetPK

func (row *GatewayMock) GetPK() map[string]interface{}

type GatewayOrgClient

type GatewayOrgClient struct {
	OrgId        string `json:"org_id" xorm:"not null VARCHAR(32)"`
	Name         string `json:"name" xorm:"not null default '' comment('消费者名称') VARCHAR(128)"`
	ClientSecret string `json:"client_secret" xorm:"not null default '' comment('客户端凭证') VARCHAR(32)"`
	BaseRow      `xorm:"extends"`
}

type GatewayPackage

type GatewayPackage struct {
	DiceOrgId          string `json:"dice_org_id" xorm:"not null comment('dice企业标识id') VARCHAR(32)"`
	DiceProjectId      string `json:"dice_project_id" xorm:"default '' comment('dice项目标识id') VARCHAR(32)"`
	DiceEnv            string `json:"dice_env" xorm:"not null comment('dice环境') VARCHAR(32)"`
	DiceClusterName    string `json:"dice_cluster_name" xorm:"not null comment('dice集群名') VARCHAR(32)"`
	ZoneId             string `json:"zone_id" xorm:"comment('所属的zone') VARCHAR(32)"`
	PackageName        string `json:"package_name" xorm:"not null comment('产品包名称') VARCHAR(32)"`
	BindDomain         string `json:"bind_domain" xorm:"comment('绑定的域名') VARCHAR(1024)"`
	Description        string `json:"description" xorm:"comment('描述') VARCHAR(256)"`
	AclType            string `json:"acl_type" xorm:"not null default 'off' comment('授权方式') VARCHAR(16)"`
	AuthType           string `json:"auth_type" xorm:"not null default '' comment('鉴权方式') VARCHAR(16)"`
	Scene              string `json:"scene" xorm:"not null default '' comment('场景') VARCHAR(32)"`
	RuntimeServiceId   string `json:"runtime_service_id" xorm:"not null default '' comment('关联的service的id') VARCHAR(32)"`
	CloudapiInstanceId string `json:"cloudapi_instance_id" xorm:"not null default '' comment('阿里云API网关的实例id') VARCHAR(128)"`
	CloudapiGroupId    string `json:"cloudapi_group_id" xorm:"not null default '' comment('阿里云API网关的分组id') VARCHAR(128)"`
	CloudapiVpcGrant   string `json:"cloudapi_vpc_grant" xorm:"not null default '' comment('阿里云API网关的VPC Grant') VARCHAR(128)"`
	CloudapiDomain     string `json:"cloudapi_domain" xorm:"not null default '' comment('阿里云API网关的分组二级域名') VARCHAR(1024)"`
	CloudapiNeedBind   int    `json:"cloudapi_need_bind" xorm:"default 0 comment('是否需要绑定阿里云API网关') TINYINT(1)"`
	BaseRow            `xorm:"extends"`
}

type GatewayPackageApi

type GatewayPackageApi struct {
	PackageId        string `json:"package_id" xorm:"default '' comment('所属的产品包id') VARCHAR(32)"`
	ApiPath          string `json:"api_path" xorm:"not null default '' comment('api路径') VARCHAR(256)"`
	Method           string `json:"method" xorm:"not null default '' comment('方法') VARCHAR(128)"`
	RedirectAddr     string `json:"redirect_addr" xorm:"not null default '' comment('转发地址') VARCHAR(256)"`
	RedirectPath     string `json:"redirect_path" xorm:"not null default '' comment('转发路径') VARCHAR(256)"`
	Description      string `json:"description" xorm:"comment('描述') VARCHAR(256)"`
	DiceApp          string `json:"dice_app" xorm:"default '' comment('dice应用名') VARCHAR(128)"`
	DiceService      string `json:"dice_service" xorm:"default '' comment('dice服务名') VARCHAR(128)"`
	AclType          string `json:"acl_type" xorm:"default '' comment('独立的授权类型') VARCHAR(16)"`
	Origin           string `json:"origin" xorm:"not null default 'custom' comment('来源') VARCHAR(16)"`
	DiceApiId        string `json:"dice_api_id" xorm:"comment('对应dice服务api的id') VARCHAR(32)"`
	RedirectType     string `json:"redirect_type" xorm:"not null default 'url' comment('转发类型') VARCHAR(32)"`
	RuntimeServiceId string `json:"runtime_service_id" xorm:"not null default '' comment('关联的service的id') VARCHAR(32)"`
	ZoneId           string `json:"zone_id" xorm:"comment('所属的zone') VARCHAR(32)"`
	CloudapiApiId    string `json:"cloudapi_api_id" xorm:"not null default '' comment('阿里云API网关的api id') VARCHAR(128)"`
	BaseRow          `xorm:"extends"`
}

type GatewayPackageApiInConsumer

type GatewayPackageApiInConsumer struct {
	ConsumerId   string `json:"consumer_id" xorm:"not null default '' comment('消费者id') VARCHAR(32)"`
	PackageId    string `json:"package_id" xorm:"not null default '' comment('产品包id') VARCHAR(32)"`
	PackageApiId string `json:"package_api_id" xorm:"not null default '' comment('产品包 apiid') VARCHAR(32)"`
	BaseRow      `xorm:"extends"`
}

type GatewayPackageInConsumer

type GatewayPackageInConsumer struct {
	ConsumerId string `json:"consumer_id" xorm:"not null default '' comment('消费者id') VARCHAR(32)"`
	PackageId  string `json:"package_id" xorm:"not null default '' comment('产品包id') VARCHAR(32)"`
	BaseRow    `xorm:"extends"`
}

type GatewayPackageRule

type GatewayPackageRule struct {
	ApiId           string `json:"api_id" xorm:"comment('产品包api id') VARCHAR(32)"`
	Category        string `json:"category" xorm:"not null default '' comment('插件类目') VARCHAR(32)"`
	Config          []byte `json:"config" xorm:"comment('具体配置') BLOB"`
	ConsumerId      string `json:"consumer_id" xorm:"not null default '' comment('消费者id') VARCHAR(32)"`
	ConsumerName    string `json:"consumer_name" xorm:"not null default '' comment('消费者名称') VARCHAR(128)"`
	DiceEnv         string `json:"dice_env" xorm:"not null comment('dice环境') VARCHAR(32)"`
	DiceOrgId       string `json:"dice_org_id" xorm:"not null comment('dice企业标识id') VARCHAR(32)"`
	DiceProjectId   string `json:"dice_project_id" xorm:"default '' comment('dice项目标识id') VARCHAR(32)"`
	DiceClusterName string `json:"dice_cluster_name" xorm:"not null comment('dice集群名') VARCHAR(32)"`
	Enabled         int    `json:"enabled" xorm:"default 1 comment('插件开关') TINYINT(1)"`
	PackageZoneNeed int    `json:"package_zone_need" xorm:"default 1 comment('是否在pcakge的zone生效') TINYINT(1)"`
	PackageId       string `json:"package_id" xorm:"not null default '' comment('产品包id') VARCHAR(32)"`
	PackageName     string `json:"package_name" xorm:"not null comment('产品包名称') VARCHAR(32)"`
	PluginId        string `json:"plugin_id" xorm:"not null default '' comment('插件id') VARCHAR(128)"`
	PluginName      string `json:"plugin_name" xorm:"not null default '' comment('插件名称') VARCHAR(128)"`
	BaseRow         `xorm:"extends"`
}

type GatewayPlugin

type GatewayPlugin struct {
	PluginName  string `json:"plugin_name" xorm:"not null default '' comment('插件名称') unique VARCHAR(128)"`
	Category    string `json:"category" xorm:"not null default '' comment('类目') VARCHAR(32)"`
	Description string `json:"description" xorm:"comment('插件描述') VARCHAR(256)"`
	ConfigVars  string `json:"config_vars" xorm:"comment('插件配置约定') VARCHAR(512)"`
	BaseRow     `xorm:"extends"`
}

type GatewayPluginInstance

type GatewayPluginInstance struct {
	PluginId   string `json:"plugin_id" xorm:"not null default '' comment('插件id') index VARCHAR(128)"`
	PluginName string `json:"plugin_name" xorm:"not null default '' comment('插件名称') VARCHAR(128)"`
	PolicyId   string `json:"policy_id" xorm:"not null default '' comment('策略id') VARCHAR(32)"`
	ConsumerId string `json:"consumer_id" xorm:"comment('消费者id') VARCHAR(32)"`
	GroupId    string `json:"group_id" xorm:"comment('组id') VARCHAR(32)"`
	RouteId    string `json:"route_id" xorm:"comment('路由id') VARCHAR(32)"`
	ServiceId  string `json:"service_id" xorm:"comment('服务id') VARCHAR(32)"`
	ApiId      string `json:"api_id" xorm:"default '' comment('apiID') VARCHAR(32)"`
	BaseRow    `xorm:"extends"`
}

type GatewayPolicy

type GatewayPolicy struct {
	ZoneId      string `json:"zone_id" xorm:"default '' comment('所属的zone') VARCHAR(32)"`
	PolicyName  string `json:"policy_name" xorm:"default '' comment('策略名称') VARCHAR(128)"`
	DisplayName string `json:"display_name" xorm:"not null default '' comment('策略展示名称') VARCHAR(128)"`
	Category    string `json:"category" xorm:"not null default '' comment('策略类目') VARCHAR(128)"`
	Description string `json:"description" xorm:"not null default '' comment('描述类目') VARCHAR(128)"`
	PluginId    string `json:"plugin_id" xorm:"default '' comment('插件id') VARCHAR(128)"`
	PluginName  string `json:"plugin_name" xorm:"not null default '' comment('插件名称') VARCHAR(128)"`
	Config      []byte `json:"config" xorm:"comment('具体配置') BLOB"`
	ConsumerId  string `json:"consumer_id" xorm:"default null comment('消费者id') VARCHAR(32)"`
	Enabled     int    `json:"enabled" xorm:"default 1 comment('插件开关') TINYINT(1)"`
	ApiId       string `json:"api_id" xorm:"comment('api id') VARCHAR(32)"`
	BaseRow     `xorm:"extends"`
}

type GatewayRoute

type GatewayRoute struct {
	RouteId   string `json:"route_id" xorm:"not null default '' comment('路由id') index VARCHAR(128)"`
	Protocols string `json:"protocols" xorm:"comment('协议列表') VARCHAR(128)"`
	Methods   string `json:"methods" xorm:"comment('方法列表') VARCHAR(128)"`
	Hosts     string `json:"hosts" xorm:"comment('主机列表') VARCHAR(256)"`
	Paths     string `json:"paths" xorm:"comment('路径列表') VARCHAR(256)"`
	ServiceId string `json:"service_id" xorm:"not null default '' comment('绑定服务id') VARCHAR(32)"`
	Config    string `json:"config" xorm:"default '' comment('选填配置') VARCHAR(1024)"`
	ApiId     string `json:"api_id" xorm:"not null default '' comment('apiid') VARCHAR(32)"`
	BaseRow   `xorm:"extends"`
}

type GatewayRuntimeService

type GatewayRuntimeService struct {
	ProjectId        string `json:"project_id" xorm:"not null default '' comment('所属项目') index(idx_config_tenant) VARCHAR(32)"`
	Workspace        string `json:"workspace" xorm:"not null default '' comment('所属环境') index(idx_config_tenant) VARCHAR(32)"`
	ClusterName      string `json:"cluster_name" xorm:"not null default '' comment('所属集群') index(idx_config_tenant) VARCHAR(32)"`
	RuntimeId        string `json:"runtime_id" xorm:"not null default '' comment('所属runtime') index(idx_runtime) VARCHAR(32)"`
	RuntimeName      string `json:"runtime_name" xorm:"not null default '' comment('runtime名称') VARCHAR(128)"`
	ReleaseId        string `json:"release_id" xorm:"not null default '' comment('runtime名称') VARCHAR(128)"`
	GroupNamespace   string `json:"group_namespace" xorm:"not null default '' comment('runtime名称') VARCHAR(128)"`
	GroupName        string `json:"group_name" xorm:"not null default '' comment('runtime名称') VARCHAR(128)"`
	ProjectNamespace string `json:"project_namespace" xorm:"not null default '' comment('项目级 namespace') VARCHAR(128)"`
	AppId            string `json:"app_id" xorm:"not null default '' comment('所属应用') VARCHAR(32)"`
	AppName          string `json:"app_name" xorm:"not null default '' comment('应用名称') VARCHAR(128)"`
	ServiceName      string `json:"service_name" xorm:"not null default '' comment('服务名称') VARCHAR(128)"`
	ServicePort      int    `json:"service_port" xorm:"not null default 0 comment('服务监听端口') INT(11)"`
	InnerAddress     string `json:"inner_address" xorm:"comment('服务内部地址') VARCHAR(1024)"`
	UseApigw         int    `json:"use_apigw" xorm:"not null default 0 comment('是否使用api网关') TINYINT(1)"`
	IsEndpoint       int    `json:"is_endpoint" xorm:"not null default 0 comment('是否是endpoint') TINYINT(1)"`
	IsSecurity       int    `json:"is_security" xorm:"not null default 0 comment('是否需要安全加密') TINYINT(1)"`
	BackendProtocol  string `json:"backend_protocol" xorm:"not null default '' comment('后端协议') VARCHAR(16)"`
	BaseRow          `xorm:"extends"`
}

type GatewayService

type GatewayService struct {
	ServiceId   string `json:"service_id" xorm:"not null default '' comment('服务id') index VARCHAR(128)"`
	ServiceName string `json:"service_name" xorm:"comment('服务名称') VARCHAR(64)"`
	Url         string `json:"url" xorm:"comment('具体路径') VARCHAR(256)"`
	Protocol    string `json:"protocol" xorm:"comment('协议') VARCHAR(32)"`
	Host        string `json:"host" xorm:"comment('主机') VARCHAR(128)"`
	Port        string `json:"port" xorm:"comment('端口') VARCHAR(32)"`
	Path        string `json:"path" xorm:"comment('路径') VARCHAR(128)"`
	Config      string `json:"config" xorm:"comment('选填配置') VARCHAR(1024)"`
	ApiId       string `json:"api_id" xorm:"not null default '' comment('apiid') VARCHAR(32)"`
	BaseRow     `xorm:"extends"`
}

type GatewayTransConfig

type GatewayTransConfig struct {
	EnvType       string `json:"env_type" xorm:"VARCHAR(32)"`
	RuntimeId     string `json:"runtime_id" xorm:"VARCHAR(64)"`
	ClusterName   string `json:"cluster_name" xorm:"VARCHAR(32)"`
	TargetKey     string `json:"target_key" xorm:"VARCHAR(512)"`
	TargetType    string `json:"target_type" xorm:"VARCHAR(64)"`
	DubboTarget   string `json:"dubbo_target" xorm:"default '' VARCHAR(4096)"`
	OperationType string `json:"operation_type" xorm:"VARCHAR(64)"`
	ZkUrl         string `json:"zk_url" xorm:"VARCHAR(256)"`
	BaseRow       `xorm:"extends"`
}

type GatewayUpstream

type GatewayUpstream struct {
	ZoneId           string `json:"zone_id" xorm:"default '' comment('所属的zone') VARCHAR(32)"`
	OrgId            string `json:"org_id" xorm:"not null comment('企业标识id') VARCHAR(32)"`
	ProjectId        string `json:"project_id" xorm:"not null comment('项目标识id') VARCHAR(32)"`
	UpstreamName     string `json:"upstream_name" xorm:"not null comment('应用名称') VARCHAR(128)"`
	DiceApp          string `json:"dice_app" xorm:"default '' comment('dice应用名') varchar(128)"`
	DiceService      string `json:"dice_service" xorm:"default '' comment('dice服务名') varchar(128)"`
	Env              string `json:"env" xorm:"not null comment('应用所属环境') VARCHAR(32)"`
	Az               string `json:"az" xorm:"not null comment('集群名') VARCHAR(32)"`
	LastRegisterId   string `json:"last_register_id" xorm:"not null comment('应用最近一次注册id') VARCHAR(64)"`
	ValidRegisterId  string `json:"valid_register_id" xorm:"not null comment('应用当前生效的注册id') VARCHAR(64)"`
	AutoBind         int    `json:"auto_bind" xorm:"not null default 1 comment('api是否自动绑定') TINYINT(1)"`
	RuntimeServiceId string `json:"runtime_service_id" xorm:"not null default '' comment('关联的service的id') VARCHAR(32)"`
	BaseRow          `xorm:"extends"`
}

type GatewayUpstreamApi

type GatewayUpstreamApi struct {
	UpstreamId  string `json:"upstream_id" xorm:"not null comment('应用标识id') VARCHAR(32)"`
	RegisterId  string `json:"register_id" xorm:"not null comment('应用注册id') VARCHAR(64)"`
	ApiName     string `json:"api_name" xorm:"not null comment('标识api的名称,应用下唯一') VARCHAR(256)"`
	Path        string `json:"path" xorm:"not null comment('注册的api路径') VARCHAR(256)"`
	GatewayPath string `json:"gateway_path" xorm:"not null comment('网关api路径') VARCHAR(256)"`
	Method      string `json:"method" xorm:"not null comment('注册的api方法') VARCHAR(256)"`
	Address     string `json:"address" xorm:"not null comment('注册的转发地址') VARCHAR(256)"`
	Doc         []byte `json:"doc" xorm:"comment('api描述') BLOB"`
	ApiId       string `json:"api_id" xorm:"default '' comment('api标识id') VARCHAR(32)"`
	IsInner     int    `json:"is_inner" xorm:"not null default 0 comment('是否是内部api') TINYINT(1)"`
	Domains     string `json:"domains" xorm:"not null default '' comment('gateway api 的域名列表, 逗号隔开') VARCHAR(1024)"`
	BaseRow     `xorm:"extends"`
}

type GatewayUpstreamLb

type GatewayUpstreamLb struct {
	ZoneId           string `json:"zone_id" xorm:"default '' comment('所属的zone') VARCHAR(32)"`
	OrgId            string `json:"org_id" xorm:"not null comment('企业标识id') VARCHAR(32)"`
	ProjectId        string `json:"project_id" xorm:"not null comment('项目标识id') VARCHAR(32)"`
	LbName           string `json:"lb_name" xorm:"not null comment('应用名称') VARCHAR(128)"`
	Env              string `json:"env" xorm:"not null comment('应用所属环境') VARCHAR(32)"`
	Az               string `json:"az" xorm:"not null comment('集群名') VARCHAR(32)"`
	LastDeploymentId int    `json:"last_deployment_id" xorm:"not null comment('最近一次target上线请求的部署id') INT(11)"`
	KongUpstreamId   string `json:"kong_upstream_id" xorm:"comment('kong的upstream_id') VARCHAR(128)"`
	HealthcheckPath  string `json:"healthcheck_path" xorm:"comment('HTTP健康检查路径') VARCHAR(128)"`
	Config           []byte `json:"config" xorm:"comment('负载均衡配置') BLOB"`
	BaseRow          `xorm:"extends"`
}

type GatewayUpstreamLbTarget

type GatewayUpstreamLbTarget struct {
	LbId         string `json:"lb_id" xorm:"not null comment('关联的lb id') VARCHAR(32)"`
	DeploymentId int    `json:"deployment_id" xorm:"not null comment('上线时的deployment_id') INT(11)"`
	KongTargetId string `json:"kong_target_id" xorm:"comment('kong的target_id') VARCHAR(128)"`
	Target       string `json:"target" xorm:"comment('目的地址') VARCHAR(64)"`
	Healthy      int    `json:"healthy" xorm:"not null default 1 comment('是否健康') TINYINT(1)"`
	Weight       int    `json:"weight" xorm:"not null default 100 comment('轮询权重') INT(11)"`
	BaseRow      `xorm:"extends"`
}

type GatewayUpstreamRegisterRecord

type GatewayUpstreamRegisterRecord struct {
	UpstreamId   string `json:"upstream_id" xorm:"not null comment('应用标识id') VARCHAR(32)"`
	RegisterId   string `json:"register_id" xorm:"not null comment('应用注册id') VARCHAR(64)"`
	UpstreamApis []byte `json:"upstream_apis" xorm:"comment('api注册列表') BLOB"`
	BaseRow      `xorm:"extends"`
}

type GatewayZone

type GatewayZone struct {
	Name            string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(1024)"`
	Type            string `json:"type" xorm:"not null default '' comment('类型') VARCHAR(16)"`
	KongPolicies    []byte `json:"kong_policies" xorm:"comment('包含的kong策略id') BLOB"`
	IngressPolicies []byte `json:"ingress_policies" xorm:"comment('包含的ingress策略id') BLOB"`
	BindDomain      string `json:"bind_domain" xorm:"comment('绑定的域名') VARCHAR(1024)"`
	DiceOrgId       string `json:"dice_org_id" xorm:"not null comment('dice企业标识id') VARCHAR(32)"`
	DiceProjectId   string `json:"dice_project_id" xorm:"default '' comment('dice项目标识id') VARCHAR(32)"`
	DiceEnv         string `json:"dice_env" xorm:"not null comment('dice应用所属环境') VARCHAR(32)"`
	DiceClusterName string `json:"dice_cluster_name" xorm:"not null comment('dice集群名') VARCHAR(32)"`
	DiceApp         string `json:"dice_app" xorm:"default '' comment('dice应用名') VARCHAR(128)"`
	DiceService     string `json:"dice_service" xorm:"default '' comment('dice服务名') VARCHAR(128)"`
	TenantId        string `json:"tenant_id" xorm:"not null default '' comment('租户id') VARCHAR(128)"`
	PackageApiId    string `json:"package_api_id" xorm:"not null default '' comment('流量入口中指定api的id') VARCHAR(32)"`
	BaseRow         `xorm:"extends"`
}

func (GatewayZone) HasIngress

func (zone GatewayZone) HasIngress() bool

HasIngress only zones of type 'packageApi' have ingress

type GatewayZoneInPackage

type GatewayZoneInPackage struct {
	PackageId     string `json:"package_id" xorm:"default '' comment('所属的产品包id') VARCHAR(32)"`
	PackageZoneId string `json:"package_zone_id" xorm:"default '' comment('产品包的zone id') VARCHAR(32)"`
	RoutePrefix   string `json:"route_prefix" xorm:"not null comment('路由前缀') VARCHAR(128)"`
	ZoneId        string `json:"zone_id" xorm:"default '' comment('依赖的zone id') VARCHAR(32)"`
	BaseRow       `xorm:"extends"`
}

type Ini

type Ini struct {
	IniName  string `json:"ini_name" xorm:"not null default '' comment('配置信息名称') index VARCHAR(128)"`
	IniDesc  string `json:"ini_desc" xorm:"not null default '' comment('配置信息介绍') VARCHAR(256)"`
	IniValue string `json:"ini_value" xorm:"not null default '' comment('配置信息参数值') VARCHAR(1024)"`
	BaseRow  `xorm:"extends"`
}

type OptionType

type OptionType int
const (
	FuzzyMatch OptionType = iota
	ExactMatch
	PrefixMatch
	Contains
	DescOrder
	AscOrder
)

type OrmEngine

type OrmEngine struct {
	OrmEngineInterface
	// contains filtered or unexported fields
}

func CreateSingleton

func CreateSingleton(driver string, sources []string, options map[string]string) *OrmEngine

func GetSingleton

func GetSingleton() (*OrmEngine, error)

func NewOrmEngine

func NewOrmEngine(driver string, sources []string, options map[string]string) (*OrmEngine, error)

func (*OrmEngine) GetEngine

func (engine *OrmEngine) GetEngine() (*xorm.Engine, error)

type OrmEngineInterface

type OrmEngineInterface interface {
	xorm.EngineInterface
	SetTableMapper(core.IMapper)
	RegisterSqlMap(xorm.SqlM, ...xorm.Cipher) error
	SqlMapClient(string, ...interface{}) *xorm.Session
}

type SelectOption

type SelectOption struct {
	Type   OptionType
	Column string
	Value  interface{}
}

type SqlLogWrapper

type SqlLogWrapper struct {
	*Logger
	// contains filtered or unexported fields
}
var SqlLog SqlLogWrapper

func (SqlLogWrapper) IsShowSQL

func (wrapper SqlLogWrapper) IsShowSQL() bool

func (SqlLogWrapper) Level

func (wrapper SqlLogWrapper) Level() core.LogLevel

func (SqlLogWrapper) SetLevel

func (wrapper SqlLogWrapper) SetLevel(l core.LogLevel)

func (SqlLogWrapper) ShowSQL

func (wrapper SqlLogWrapper) ShowSQL(show ...bool)

Jump to

Keyboard shortcuts

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