dao

package
v0.0.0-...-d930fad Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 46 Imported by: 0

Documentation

Overview

Package dao NOTES

Package dao NOTES

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	// Create one app instance
	Create(kit *kit.Kit, app *table.App) (uint32, error)
	// Update one app's info
	Update(kit *kit.Kit, app *table.App) error
	// get app with id.
	Get(kit *kit.Kit, bizID, appID uint32) (*table.App, error)
	// get app only with id.
	GetByID(kit *kit.Kit, appID uint32) (*table.App, error)
	// get app by name.
	GetByName(kit *kit.Kit, bizID uint32, name string) (*table.App, error)
	// List apps with options.
	List(kit *kit.Kit, bizList []uint32, name, operator string, opt *types.BasePage) ([]*table.App, int64, error)
	// ListAppsByGroupID list apps by group id.
	ListAppsByGroupID(kit *kit.Kit, groupID, bizID uint32) ([]*table.App, error)
	// ListAppsByIDs list apps by app ids.
	ListAppsByIDs(kit *kit.Kit, ids []uint32) ([]*table.App, error)
	// DeleteWithTx delete one app instance with transaction.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, app *table.App) error
	// ListAppMetaForCache list app's basic meta info.
	ListAppMetaForCache(kt *kit.Kit, bizID uint32, appID []uint32) (map[uint32]*types.AppCacheMeta, error)
	// GetByAlias 通过Alisa 查询
	GetByAlias(kit *kit.Kit, bizID uint32, alias string) (*table.App, error)
	// BatchUpdateLastConsumedTime 批量更新最后一次拉取时间
	BatchUpdateLastConsumedTime(kit *kit.Kit, bizID uint32, appIDs []uint32) error
}

App supplies all the app related operations.

type AppTemplateBinding

type AppTemplateBinding interface {
	// CreateWithTx create one app template binding instance with transaction.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, atb *table.AppTemplateBinding) (uint32, error)
	// Update one app template binding's info.
	Update(kit *kit.Kit, atb *table.AppTemplateBinding) error
	// UpdateWithTx Update one app template binding's info with transaction.
	UpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, atb *table.AppTemplateBinding) error
	// BatchUpdateWithTx batch update app template binding's instances with transaction.
	BatchUpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, data []*table.AppTemplateBinding) error
	// List app template bindings with options.
	List(kit *kit.Kit, bizID, appID uint32, opt *types.BasePage) ([]*table.AppTemplateBinding, int64, error)
	// Delete one app template binding instance.
	Delete(kit *kit.Kit, atb *table.AppTemplateBinding) error
	// DeleteByAppIDWithTx delete one app template binding instance by app id with transaction.
	DeleteByAppIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID uint32) error
	// ListAppTemplateBindingByAppIds 按 AppId 列出应用模板绑定
	ListAppTemplateBindingByAppIds(kit *kit.Kit, bizID uint32, appIDs []uint32) ([]*table.AppTemplateBinding, error)
	// GetAppTemplateBindingByAppID 通过业务和服务ID获取模板绑定关系
	GetAppTemplateBindingByAppID(kit *kit.Kit, bizID, appID uint32) (*table.AppTemplateBinding, error)
	// UpsertWithTx create or update one template variable instance with transaction.
	UpsertWithTx(kit *kit.Kit, tx *gen.QueryTx, atb *table.AppTemplateBinding) error
	// GetBindingAppByTemplateSetID 通过套餐ID获取绑定的服务
	GetBindingAppByTemplateSetID(kit *kit.Kit, bizID uint32, templateSetIDs []uint32) ([]*table.AppTemplateBinding, error)
	// GetAppTemplateBindingByAppIDWithTx get app template binding with transaction instance through biz id and app id
	GetAppTemplateBindingByAppIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID,
		appID uint32) (*table.AppTemplateBinding, error)
}

AppTemplateBinding supplies all the app template binding related operations.

type AppTemplateVariable

type AppTemplateVariable interface {
	// Upsert create or update one template variable instance.
	Upsert(kit *kit.Kit, appVar *table.AppTemplateVariable) error
	// UpsertWithTx create or update one template variable instance with transaction.
	UpsertWithTx(kit *kit.Kit, tx *gen.QueryTx, appVar *table.AppTemplateVariable) error
	// Get gets app template variables
	Get(kit *kit.Kit, bizID, appID uint32) (*table.AppTemplateVariable, error)
	// ListVariables lists all variables in app template variable
	ListVariables(kit *kit.Kit, bizID, appID uint32) ([]*table.TemplateVariableSpec, error)
	// DeleteWithTx delete one app template variable instance with transaction.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID uint32) error
	// GetTemplateVariableWithTx get app template variable instance with transaction.
	GetTemplateVariableWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID uint32) (
		*table.AppTemplateVariable, error)
}

AppTemplateVariable supplies all the app template variable related operations.

type AuditBuilder

type AuditBuilder struct {
	// contains filtered or unexported fields
}

AuditBuilder is a wrapper decorator to handle all the resource's audit operation.

func (*AuditBuilder) AuditCreate

func (ab *AuditBuilder) AuditCreate(cur interface{}, opt *AuditOption) error

AuditCreate set the resource's current details. Note: 1. must call this after the resource has already been created. 2. cur should be a *struct.

func (*AuditBuilder) AuditPublish

func (ab *AuditBuilder) AuditPublish(cur interface{}, opt *AuditOption) error

AuditPublish set the publish content's current details. Note: 1. must call this after the resource has already been published. 2. cur should be a *struct.

func (*AuditBuilder) Do

func (ab *AuditBuilder) Do(opt *AuditOption) error

Do save audit log to the db immediately.

func (*AuditBuilder) PrepareDelete

func (ab *AuditBuilder) PrepareDelete(resID uint32) AuditDecorator

PrepareDelete prepare the resource's previous instance details by get the instance's detail from db and save it to ab.prev for later use. Note: call this before resource is deleted.

func (*AuditBuilder) PrepareUpdate

func (ab *AuditBuilder) PrepareUpdate(updatedTo interface{}) AuditDecorator

PrepareUpdate prepare the resource's previous instance details by get the instance's detail from db and save it to ab.prev for later use. Note: 1. call this before resource is updated. 2. updatedTo means 'to be updated to data', it should be a *struct.

type AuditBuilderV2

type AuditBuilderV2 struct {
	// contains filtered or unexported fields
}

AuditBuilderV2 is a wrapper decorator to handle all the resource's audit operation.

func (*AuditBuilderV2) Do

func (ab *AuditBuilderV2) Do(tx *gen.Query) error

Do save audit log to the db immediately.

func (*AuditBuilderV2) GetAuditID

func (ab *AuditBuilderV2) GetAuditID() uint32

GetAuditID get audit id.

func (*AuditBuilderV2) PrepareCreate

func (ab *AuditBuilderV2) PrepareCreate(obj AuditRes) AuditDo

PrepareCreate 创建资源

func (*AuditBuilderV2) PrepareCreateByInstance

func (ab *AuditBuilderV2) PrepareCreateByInstance(resId uint32, obj interface{}) AuditDo

PrepareCreateByInstance 创建资源

func (*AuditBuilderV2) PrepareDelete

func (ab *AuditBuilderV2) PrepareDelete(obj AuditRes) AuditDo

PrepareDelete 删除资源

func (*AuditBuilderV2) PreparePublish

func (ab *AuditBuilderV2) PreparePublish(obj AuditRes) AuditDo

PreparePublish 发布配置

func (*AuditBuilderV2) PrepareUpdate

func (ab *AuditBuilderV2) PrepareUpdate(obj, oldObj AuditRes) AuditDo

PrepareUpdate 更新资源, 会记录 spec 对比值

type AuditDao

type AuditDao interface {
	// Decorator is used to handle the audit process as a pipeline
	// according CUD scenarios.
	Decorator(kit *kit.Kit, bizID uint32, res enumor.AuditResourceType) AuditDecorator
	DecoratorV2(kit *kit.Kit, bizID uint32) AuditPrepare
	DecoratorV3(kit *kit.Kit, bizID uint32, a *table.AuditField) AuditPrepare
	// One insert one resource's audit.
	One(kit *kit.Kit, audit *table.Audit, opt *AuditOption) error
	// ListAuditsAppStrategy List audit apo strategy.
	ListAuditsAppStrategy(
		kit *kit.Kit, req *pbds.ListAuditsReq) ([]*types.ListAuditsAppStrategy, int64, error)
	// UpdateByStrategyID update audit kv by strategyID.
	UpdateByStrategyID(kit *kit.Kit, tx *gen.QueryTx, strategyID uint32, m map[string]interface{}) error
	// UpdateByStrategyIDs update audit kv by strategyIDs.
	UpdateByStrategyIDs(
		kit *kit.Kit, tx *gen.QueryTx, strategyID []uint32, m map[string]interface{}) error
}

AuditDao supplies all the audit operations.

func NewAuditDao

func NewAuditDao(db *gorm.DB, orm orm.Interface, sd *sharding.Sharding, idGen IDGenInterface) (AuditDao, error)

NewAuditDao create the audit DAO

type AuditDecorator

type AuditDecorator interface {
	AuditCreate(cur interface{}, opt *AuditOption) error
	PrepareUpdate(updatedTo interface{}) AuditDecorator
	PrepareDelete(resID uint32) AuditDecorator
	AuditPublish(cur interface{}, opt *AuditOption) error
	Do(opt *AuditOption) error
}

AuditDecorator is audit decorator interface, use to record audit.

type AuditDo

type AuditDo interface {
	Do(tx *gen.Query) error
	GetAuditID() uint32
}

AuditDo audit traction action

type AuditOption

type AuditOption struct {
	// resource's transaction infos.
	Txn *sqlx.Tx
	// ResShardingUid is the resource's sharding instance.
	ResShardingUid string
	// contains filtered or unexported fields
}

AuditOption defines all the needed infos to audit a resource.

type AuditPrepare

type AuditPrepare interface {
	PrepareCreate(obj AuditRes) AuditDo
	PrepareUpdate(obj, oldObj AuditRes) AuditDo
	PrepareDelete(obj AuditRes) AuditDo
	PreparePublish(obj AuditRes) AuditDo
	PrepareCreateByInstance(resId uint32, obj interface{}) AuditDo
}

AuditPrepare auditBuilder interface

type AuditRes

type AuditRes interface {
	AppID() uint32
	ResType() string
	ResID() uint32
}

AuditRes audit Res interface

type Client

type Client interface {
	// BatchCreateWithTx batch create client instances with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, data []*table.Client) error
	// BatchUpdateWithTx batch update client instances with transaction.
	BatchUpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, data []*table.Client) error
	// ListClientByTuple Query the client list according to multiple fields in
	ListClientByTuple(kit *kit.Kit, data [][]interface{}) ([]*table.Client, error)
	// ListByHeartbeatTimeOnlineState obtain data based on the last heartbeat time and online status
	ListByHeartbeatTimeOnlineState(kit *kit.Kit, heartbeatTime time.Time, onlineState string,
		limit int, id uint32) ([]*table.Client, error)
	// UpdateClientOnlineState Update the online status of the client
	UpdateClientOnlineState(kit *kit.Kit, heartbeatTime time.Time, onlineState string, ids []uint32) error
	// GetClientCountByCondition Get the total according to the condition
	GetClientCountByCondition(kit *kit.Kit, heartbeatTime time.Time, onlineState string) (int64, error)
	// List Obtain client data according to conditions
	List(kit *kit.Kit, bizID, appID uint32, heartbeatTime int64, search *pbclient.ClientQueryCondition,
		order *pbds.ListClientsReq_Order, opt *types.BasePage) ([]*table.Client, int64, error)
	// ListClientGroupByCurrentReleaseID 按当前版本 ID 列出客户端组
	ListClientGroupByCurrentReleaseID(kit *kit.Kit, bizID, appID uint32, heartbeatTime int64,
		search *pbclient.ClientQueryCondition) ([]types.CurrentConfigVersionChart, error)
	// ListClientGroupByChangeStatus 按更改状态列出客户端组
	ListClientGroupByChangeStatus(kit *kit.Kit, bizID, appID uint32, heartbeatTime int64,
		search *pbclient.ClientQueryCondition) ([]types.ChangeStatusChart, error)
	// ListClientGroupByFailedReason 按失败原因列出客户端组
	ListClientGroupByFailedReason(kit *kit.Kit, bizID, appID uint32, heartbeatTime int64,
		search *pbclient.ClientQueryCondition) ([]types.FailedReasonChart, error)
	// GetResourceUsage 获取资源使用率
	GetResourceUsage(kit *kit.Kit, bizID, appID uint32, heartbeatTime int64,
		search *pbclient.ClientQueryCondition) (types.ResourceUsage, error)
	// ListClientByIDs 按多个 ID 列出客户端
	ListClientByIDs(kit *kit.Kit, bizID, appID uint32, ids []uint32) ([]*table.Client, error)
	// UpsertHeartbeat 更新插入心跳
	UpsertHeartbeat(kit *kit.Kit, tx *gen.QueryTx, data []*table.Client) error
	// UpsertVersionChange 更新插入版本更改
	UpsertVersionChange(kit *kit.Kit, tx *gen.QueryTx, data []*table.Client) error
	// UpdateRetriedClientsStatusWithTx batch update client release change failed status to
	// processing status instances with transaction.
	UpdateRetriedClientsStatusWithTx(kit *kit.Kit, tx *gen.QueryTx, ids []uint32, all bool) error
	// FetchIDsExcluding 获取排除指定ID后的ID
	FetchIDsExcluding(kit *kit.Kit, bizID uint32, appID uint32, ids []uint32) ([]uint32, error)
	// ListClientGroupByTargetReleaseID 按目标版本 ID 列出客户端组
	ListClientGroupByTargetReleaseID(kit *kit.Kit, bizID, appID uint32, heartbeatTime int64,
		search *pbclient.ClientQueryCondition) ([]types.TargetConfigVersionChart, error)
	// CountNumberOlineClients 统计客户端在线数量
	CountNumberOlineClients(kit *kit.Kit, bizID, appID uint32, heartbeatTime int64,
		search *pbclient.ClientQueryCondition) (int64, error)
}

Client supplies all the client related operations.

type ClientEvent

type ClientEvent interface {
	// BatchCreateWithTx batch create client event instances with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, data []*table.ClientEvent) error
	// ListClientByTuple Query the client list according to multiple fields in
	ListClientByTuple(kit *kit.Kit, data [][]interface{}) ([]*table.ClientEvent, error)
	// List list client event details
	List(kit *kit.Kit, bizID, appID, clientID uint32, startTime, endTime time.Time, searchValue string,
		order *pbds.ListClientEventsReq_Order, opt *types.BasePage) ([]*table.ClientEvent, int64, error)
	// GetMinMaxAvgTime 获取最小最大平均时间
	GetMinMaxAvgTime(kit *kit.Kit, bizID, appID uint32, clientID []uint32, releaseChangeStatus []string) (
		types.MinMaxAvgTimeChart, error)
	// GetPullTrend 获取拉取趋势
	GetPullTrend(kit *kit.Kit, bizID uint32, appID uint32, clientID []uint32, pullTime int64, isDuplicates bool) (
		[]types.PullTrend, error)
	// UpsertHeartbeat 更新插入心跳
	UpsertHeartbeat(kit *kit.Kit, tx *gen.QueryTx, data []*table.ClientEvent) error
	// UpsertVersionChange 更新插入版本更改
	UpsertVersionChange(kit *kit.Kit, tx *gen.QueryTx, data []*table.ClientEvent) error
}

ClientEvent supplies all the client event related operations.

type ClientQuery

type ClientQuery interface {
	// Create one client query instance
	Create(kit *kit.Kit, data *table.ClientQuery) (uint32, error)
	// Update one client query
	Update(kit *kit.Kit, data *table.ClientQuery) error
	// List client query with options.
	List(kit *kit.Kit, bizID, appID uint32, creator, search_type string, opt *types.BasePage) (
		[]*table.ClientQuery, int64, error)
	// Delete ..
	Delete(kit *kit.Kit, data *table.ClientQuery) error
	// ListBySearchCondition Get by search criteria
	ListBySearchCondition(kit *kit.Kit, bizID, appID uint32, creator, searchType,
		searchCondition string) ([]*table.ClientQuery, error)
	// GetBySearchName Get by search name
	GetBySearchName(kit *kit.Kit, bizID, appID uint32, creator, searchName string) (
		*table.ClientQuery, error)
}

ClientQuery supplies all the client query related operations.

type Commit

type Commit interface {
	// Create one commit instance.
	Create(kit *kit.Kit, commit *table.Commit) (uint32, error)
	// CreateWithTx create one commit instance with transaction
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, commit *table.Commit) (uint32, error)
	// BatchCreateWithTx batch create commit instances with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, commits []*table.Commit) error
	// BatchListLatestCommits batch list config itmes' latest commit.
	BatchListLatestCommits(kit *kit.Kit, bizID, appID uint32, ids []uint32) ([]*table.Commit, error)
	// GetLatestCommit get config item's latest commit.
	GetLatestCommit(kit *kit.Kit, bizID, appID, configItemID uint32) (*table.Commit, error)
	// ListAppLatestCommits list app config items' latest commit.
	ListAppLatestCommits(kit *kit.Kit, bizID, appID uint32) ([]*table.Commit, error)
	// BatchDeleteWithTx batch delete commit data instance with transaction.
	BatchDeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, commitIDs []uint32) error
	// ListCommitsByGtID get list data by greater than ID.
	ListCommitsByGtID(kit *kit.Kit, commitID, bizID, appID, configItemID uint32) ([]*table.Commit, error)
}

Commit supplies all the commit related operations.

type Config

type Config interface {
	// GetConfig Get itsm config.
	GetConfig(kit *kit.Kit, key string) (*table.Config, error)
	// UpsertConfig insert or update itsm config.
	UpsertConfig(kit *kit.Kit, itsmConfigs []*table.Config) error
}

Config supplies all the config related operations.

type ConfigItem

type ConfigItem interface {
	// CreateWithTx create one configItem instance.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, configItem *table.ConfigItem) (uint32, error)
	// BatchCreateWithTx batch create configItem instances with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID uint32, configItems []*table.ConfigItem) error
	// ValidateAppCINumber verify whether the current number of app config items has reached the maximum.
	ValidateAppCINumber(kt *kit.Kit, tx *gen.QueryTx, bizID, appID uint32) error
	// Update one configItem instance.
	Update(kit *kit.Kit, configItem *table.ConfigItem) error
	// BatchUpdateWithTx batch update configItem instances with transaction.
	BatchUpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, configItems []*table.ConfigItem) error
	// Get configItem by id
	Get(kit *kit.Kit, id, bizID uint32) (*table.ConfigItem, error)
	// GetByUniqueKey get config item by unique key
	GetByUniqueKey(kit *kit.Kit, bizID, appID uint32, name, path string) (*table.ConfigItem, error)
	// GetUniqueKeys get unique keys of all config items in one app
	GetUniqueKeys(kit *kit.Kit, bizID, appID uint32) ([]types.CIUniqueKey, error)
	// ListAllByAppID list all configItem by appID
	ListAllByAppID(kit *kit.Kit, appID uint32, bizID uint32) ([]*table.ConfigItem, error)
	// Delete one configItem instance.
	Delete(kit *kit.Kit, configItem *table.ConfigItem) error
	// Delete one configItem instance with transaction.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, configItem *table.ConfigItem) error
	// BatchDeleteWithTx batch configItem instances with transaction.
	BatchDeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, ids []uint32, bizID, appID uint32) error
	// GetCount bizID config count
	GetCount(kit *kit.Kit, bizID uint32, appId []uint32) ([]*table.ListConfigItemCounts, error)
	// ListConfigItemByTuple 按照多个字段in查询config item 列表
	ListConfigItemByTuple(kit *kit.Kit, data [][]interface{}) ([]*table.ConfigItem, error)
	// RecoverConfigItem 恢复单个配置项(恢复的配置项使用原来的ID)
	RecoverConfigItem(kit *kit.Kit, tx *gen.QueryTx, configItem *table.ConfigItem) error
	// UpdateWithTx one configItem instance with transaction.
	UpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, configItem *table.ConfigItem) error
	// GetConfigItemCount 获取配置项数量
	GetConfigItemCount(kit *kit.Kit, bizID uint32, appID uint32) (int64, error)
	// ListConfigItemCount 展示配置项数量
	ListConfigItemCount(kit *kit.Kit, bizID uint32, appID []uint32) ([]types.ListConfigItemCount, error)
	// GetConfigItemCount 获取配置项数量带有事务
	GetConfigItemCountWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID uint32, appID uint32) (int64, error)
}

ConfigItem supplies all the configItem related operations.

type Content

type Content interface {
	// Create one content instance.
	Create(kit *kit.Kit, content *table.Content) (uint32, error)
	// CreateWithTx create one content instance with transaction
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, content *table.Content) (uint32, error)
	// BatchCreateWithTx batch create content instances with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, contents []*table.Content) error
	// Get get content by id
	Get(kit *kit.Kit, id, bizID uint32) (*table.Content, error)
	// BatchDeleteWithTx batch delete content data instance with transaction.
	BatchDeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, contentIDs []uint32) error
	// ListAllCISigns lists all non-template ci signatures of one biz, and only belongs to existing apps
	ListAllCISigns(kit *kit.Kit, bizID uint32) ([]string, error)
}

Content supplies all the content related operations.

type Credential

type Credential interface {
	// Get get credential
	Get(kit *kit.Kit, bizID, id uint32) (*table.Credential, error)
	// GetByCredentialString get credential by credential string
	GetByCredentialString(kit *kit.Kit, bizID uint32, credential string) (*table.Credential, error)
	// ListByCredentialString list credential by credential string array
	ListByCredentialString(kit *kit.Kit, bizID uint32, credentials []string) ([]*table.Credential, error)
	// BatchListByIDs batch list credential by ids
	BatchListByIDs(kit *kit.Kit, bizID uint32, ids []uint32) ([]*table.Credential, error)
	// Create one credential instance.
	Create(kit *kit.Kit, credential *table.Credential) (uint32, error)
	// List get credentials
	List(kit *kit.Kit, bizID uint32, searchKey string, opt *types.BasePage,
		topIds []uint32, encCredential string, enable *bool) ([]*table.Credential, int64, error)
	// DeleteWithTx delete credential with transaction
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, id uint32) error
	// Update update credential
	Update(kit *kit.Kit, credential *table.Credential) error
	// UpdateRevisionWithTx update credential revision with transaction
	UpdateRevisionWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, id uint32) error
	// GetByName get Credential by name.
	GetByName(kit *kit.Kit, bizID uint32, name string) (*table.Credential, error)
}

Credential supplies all the Credential related operations.

type CredentialScope

type CredentialScope interface {
	// CreateWithTx create credential scope with transaction
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, credential *table.CredentialScope) (uint32, error)
	// Get get credential scopes
	Get(kit *kit.Kit, credentialId, bizID uint32) ([]*table.CredentialScope, int64, error)
	// ListAll list all credential scopes under the business
	ListAll(kit *kit.Kit, bizID uint32) ([]*table.CredentialScope, error)
	// DeleteWithTx delete credential scope with transaction
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, id uint32) error
	// UpdateWithTx update credential scope with transaction
	UpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, credentialScope *table.CredentialScope) error
	// DeleteByCredentialIDWithTx delete credential scope by credential id with transaction
	DeleteByCredentialIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, credentialID uint32) error
	// BatchDeleteWithTx batch delete credential scope with transaction
	BatchDeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID uint32, ids []uint32) error
	// ListByCredentialIDs 按多个凭据 ID 列出
	ListByCredentialIDs(kit *kit.Kit, credentialIDs []uint32, bizID uint32) ([]*table.CredentialScope, error)
}

CredentialScope supplies all the credential scope related operations.

type EDecorator

type EDecorator struct {
	// contains filtered or unexported fields
}

EDecorator is the event decorator which is used to fire the event and then update the final state after the previous related resource operate db transaction is finished.

func (*EDecorator) Finalizer

func (ef *EDecorator) Finalizer(txnError error)

Finalizer do the event finalize work, if the txnError is nil, then update the related events final state with success, otherwise update it with failed.

func (*EDecorator) Fire

func (ef *EDecorator) Fire(es ...types.Event) error

Fire a resource's operate(Create/Update/Delete) event. After fire the event success, user should call the Finalizer function to do the event finalize work. Note: 1. Fire must be called *AFTER* all the logical operation has already been finished within the same transaction, which means the related resource's has already been created or updated or deleted. 2. Make sure that if the Fire execute failed, then the former resource's operations must be failed at the same time, which means the transaction will be aborted or rollback. 3. It's accepted that if a resource operation is failed but its event is recorded successfully, because when an event is consumed, its unique id will be used to check if the resource is exists or not:

(1) if not, this event will be ignored.
(2) if yes, this event will be consumed event even if it is not
a real event(because the according operation may have already
been aborted).

func (*EDecorator) FireWithTx

func (ef *EDecorator) FireWithTx(tx *gen.QueryTx, es ...types.Event) error

FireWithTx is used to fire the event with the given transaction. Note: FireWithTx would make event to success state directly

type Event

type Event interface {
	// Eventf initialize an event decorator instance to fire the event and
	// update the event's state
	Eventf(kit *kit.Kit) *EDecorator

	// List events with options.
	List(kit *kit.Kit, startCursor uint32, opt *types.BasePage) ([]*table.Event, int64, error)

	// ListConsumedEvents list events with options that is handle event by cache service.
	ListConsumedEvents(kit *kit.Kit, startCursor uint32, opt *types.BasePage) ([]*table.Event, int64, error)

	// LatestCursor get the latest event cursor which is the last already
	// consumed event's id.
	// Note:
	// if the returned cursor(event id) is 0, this means no event has been
	// consumed.
	LatestCursor(kit *kit.Kit) (uint32, error)

	// RecordCursor is used to record the cursor which describe where
	// the event has already been consumed with event id, so that the
	// event can be consumed continuously without being skipped or lost.
	RecordCursor(kit *kit.Kit, eventID uint32) error

	// Purge is used to try to remove number of consumed events, which is
	// created before, from the oldest to now order by event id.
	Purge(kit *kit.Kit, daysAgo uint) error
}

Event defines all the event related operations.

type Group

type Group interface {
	// ListAppValidGroups list app valid groups.
	ListAppValidGroups(kit *kit.Kit, bizID, appID uint32) ([]*table.Group, error)
	// CreateWithTx Create one group instance with transaction.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, group *table.Group) (uint32, error)
	// UpdateWithTx Update one group instance with transaction.
	UpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, group *table.Group) error
	// Get group by id.
	Get(kit *kit.Kit, id, bizID uint32) (*table.Group, error)
	// GetByName get group by name.
	GetByName(kit *kit.Kit, bizID uint32, name string) (*table.Group, error)
	// ListAll list all the groups in biz.
	ListAll(kit *kit.Kit, bizID uint32, topIds []uint32) ([]*table.Group, error)
	// DeleteWithTx delete one group instance with transaction.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, group *table.Group) error
	// ListAppGroups list all the groups of the app.
	ListAppGroups(kit *kit.Kit, bizID, appID uint32) ([]*table.Group, error)
	// ListGroupReleasedApps list all the released apps of the group.
	ListGroupReleasedApps(kit *kit.Kit, opts *types.ListGroupReleasedAppsOption) (
		*types.ListGroupReleasedAppsDetails, error)
}

Group supplies all the group related operations.

type GroupAppBind

type GroupAppBind interface {
	// BatchCreateWithTx batch create group app with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, items []*table.GroupAppBind) error
	// BatchDeleteByGroupIDWithTx batch delete group app by group id with transaction.
	BatchDeleteByGroupIDWithTx(kit *kit.Kit, tx *gen.QueryTx, groupID, bizID uint32) error
	// BatchDeleteByAppIDWithTx batch delete group app by app id with transaction.
	BatchDeleteByAppIDWithTx(kit *kit.Kit, tx *gen.QueryTx, appID, bizID uint32) error
	// BatchListByGroupIDs batch list group app by group ids.
	BatchListByGroupIDs(kit *kit.Kit, bizID uint32, groupIDs []uint32) ([]*table.GroupAppBind, error)
	// Get get GroupAppBind by group id and app id.
	Get(kit *kit.Kit, groupID, appID, bizID uint32) (*table.GroupAppBind, error)
}

GroupAppBind supplies all the group related operations.

type Hook

type Hook interface {
	// CreateWithTx create one hook instance with transaction.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, hook *table.Hook) (uint32, error)
	// ListWithRefer hooks with refer info.
	ListWithRefer(kit *kit.Kit, opt *types.ListHooksWithReferOption, topIDs []uint32) (
		[]*types.ListHooksWithReferDetail, int64, error)
	// ListHookReferences list hook references.
	ListHookReferences(kit *kit.Kit, opt *types.ListHookReferencesOption) (
		[]*types.ListHookReferencesDetail, int64, error)
	// CountHookTag count hook tag
	CountHookTag(kit *kit.Kit, bizID uint32) ([]*types.HookTagCount, error)
	// DeleteWithTx delete hook instance with transaction.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, g *table.Hook) error
	// Update one hook instance.
	Update(kit *kit.Kit, hook *table.Hook) error
	// UpdateWithTx update one hook instance with transaction.
	UpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, hook *table.Hook) error
	// GetByID get hook only with id.
	GetByID(kit *kit.Kit, bizID, hookID uint32) (*table.Hook, error)
	// GetByName get hook by name
	GetByName(kit *kit.Kit, bizID uint32, name string) (*table.Hook, error)
	// FetchIDsExcluding 获取指定ID后排除的ID
	FetchIDsExcluding(kit *kit.Kit, bizID uint32, ids []uint32) ([]uint32, error)
	// CountNumberUnReferences 统计未引用的数量
	CountNumberUnReferences(kit *kit.Kit, bizID uint32, opt *types.ListHooksWithReferOption) (int64, error)
	// GetReferencedIDs 获取被引用的IDs
	GetReferencedIDs(kit *kit.Kit, bizID uint32) ([]uint32, error)
}

Hook supplies all the hook related operations.

type HookRevision

type HookRevision interface {
	// Create one hook revision instance.
	Create(kit *kit.Kit, hook *table.HookRevision) (uint32, error)
	// CreateWithTx create hook revision instance with transaction.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, hr *table.HookRevision) (uint32, error)
	// Get hook revision by id
	Get(kit *kit.Kit, bizID, hookID, id uint32) (*table.HookRevision, error)
	// GetByName get HookRevision by name
	GetByName(kit *kit.Kit, bizID, hookID uint32, name string) (*table.HookRevision, error)
	// List hooks with options.
	List(kit *kit.Kit, opt *types.ListHookRevisionsOption) ([]*table.HookRevision, int64, error)
	// ListWithRefer hook revisions with refer info.
	ListWithRefer(kit *kit.Kit, opt *types.ListHookRevisionsOption) (
		[]*types.ListHookRevisionsWithReferDetail, int64, error)
	// ListHookRevisionReferences list hook references.
	ListHookRevisionReferences(kit *kit.Kit, opt *types.ListHookRevisionReferencesOption) (
		[]*types.ListHookRevisionReferencesDetail, int64, error)
	// DeleteWithTx one hook revision instance with transaction.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, hr *table.HookRevision) error
	// GetByPubState hook revision by State
	GetByPubState(kit *kit.Kit, opt *types.GetByPubStateOption) (*table.HookRevision, error)
	// DeleteByHookIDWithTx  delete revision revision with transaction
	DeleteByHookIDWithTx(kit *kit.Kit, tx *gen.QueryTx, hookID, bizID uint32) error
	// UpdatePubStateWithTx update hookRevision State instance with transaction.
	UpdatePubStateWithTx(kit *kit.Kit, tx *gen.QueryTx, hr *table.HookRevision) error
	// Update one HookRevision's info.
	Update(kit *kit.Kit, hr *table.HookRevision) error
}

HookRevision supplies all the hook revision related operations.

type IAM

type IAM interface {
	// ListInstances list instances with options.
	ListInstances(kt *kit.Kit, opts *types.ListInstancesOption) (*types.ListInstanceDetails, error)
	// FetchInstanceInfo fetch instance info with options.
	FetchInstanceInfo(kt *kit.Kit, opts *types.FetchInstanceInfoOption) (*types.FetchInstanceInfoDetails, error)
}

IAM only used to iam to pull resource callback.

type IDGenInterface

type IDGenInterface interface {
	// Batch return a list of resource's unique id as required.
	Batch(ctx *kit.Kit, resource table.Name, step int) ([]uint32, error)
	// One return one unique id for this resource.
	One(ctx *kit.Kit, resource table.Name) (uint32, error)
}

IDGenInterface supplies all the method to generate a resource's unique identity id.

func NewIDGenerator

func NewIDGenerator(sd *sharding.Sharding) IDGenInterface

NewIDGenerator create a id generator instance.

type Kv

type Kv interface {
	// Create one kv instance
	Create(kit *kit.Kit, kv *table.Kv) (uint32, error)
	// Update one kv's info
	Update(kit *kit.Kit, kv *table.Kv) error
	// List kv with options.
	List(kit *kit.Kit, opt *types.ListKvOption) ([]*table.Kv, int64, error)
	// ListAllKvByKey lists all key-value pairs based on keys
	ListAllKvByKey(kit *kit.Kit, appID uint32, bizID uint32, keys []string, kvState []string) ([]*table.Kv, error)
	// Delete ..
	Delete(kit *kit.Kit, kv *table.Kv) error
	// DeleteWithTx delete kv instance with transaction.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, kv *table.Kv) error
	// UpdateWithTx update kv instance with transaction.
	UpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, kv *table.Kv) error
	// GetByKvState get kv by KvState.
	GetByKvState(kit *kit.Kit, bizID, appID uint32, key string, kvState []string) (*table.Kv, error)
	// GetByID get kv by id.
	GetByID(kit *kit.Kit, bizID, appID, id uint32) (*table.Kv, error)
	// BatchCreateWithTx batch create content instances with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, kvs []*table.Kv) error
	// BatchUpdateWithTx batch create content instances with transaction.
	BatchUpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, kvs []*table.Kv) error
	// BatchDeleteWithTx batch delete content instances with transaction.
	BatchDeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID uint32, ids []uint32) error
	// ListAllByAppID list all Kv by appID
	ListAllByAppID(kit *kit.Kit, appID uint32, bizID uint32, kvState []string) ([]*table.Kv, error)
	// GetCount bizID config count
	GetCount(kit *kit.Kit, bizID uint32, appId []uint32) ([]*table.ListConfigItemCounts, error)
	// UpdateSelectedKVStates updates the states of selected kv pairs using a transaction
	UpdateSelectedKVStates(kit *kit.Kit, tx *gen.QueryTx, bizID, appID uint32, targetKVStates []string,
		newKVStates table.KvState) error
	// DeleteByStateWithTx deletes kv pairs with a specific state using a transaction
	DeleteByStateWithTx(kit *kit.Kit, tx *gen.QueryTx, kv *table.Kv) error
	// FetchIDsExcluding 获取指定ID后排除的ID
	FetchIDsExcluding(kit *kit.Kit, bizID uint32, appID uint32, ids []uint32) ([]uint32, error)
	// FetchKeysExcluding 获取指定keys后排除的keys
	FetchKeysExcluding(kit *kit.Kit, bizID uint32, appID uint32, keys []string) ([]string, error)
	// CountNumberUnDeleted 统计未删除的数量
	CountNumberUnDeleted(kit *kit.Kit, bizID uint32, opt *types.ListKvOption) (int64, error)
	// ListAllByAppIDWithTx list all Kv by appID using a transaction
	ListAllByAppIDWithTx(kit *kit.Kit, tx *gen.QueryTx, appID uint32, bizID uint32,
		kvState []string) ([]*table.Kv, error)
}

Kv supplies all the kv related operations.

type LockDao

type LockDao interface {
	// IncreaseCount increase the lock resource count, and returns the previous count.
	// need to call DecreaseCount after the resource is deleted to ensure the lock count is correct.
	IncreaseCount(kit *kit.Kit, tx *gen.Query, lock *table.ResourceLock, num uint32) (uint32, error)
	// DecreaseCount decrease the lock resource count, if the lock count is zero, delete the lock.
	DecreaseCount(kit *kit.Kit, tx *gen.Query, lock *table.ResourceLock, num uint32) error
	// AddUnique validate if the resource is unique by adding a lock with unique index, returns true if it is unique.
	// need to call DeleteUnique after the resource is deleted to ensure the lock unique is correct.
	AddUnique(kit *kit.Kit, tx *gen.Query, lock *table.ResourceLock) (bool, error)
	// DeleteUnique delete the unique resource lock.
	DeleteUnique(kit *kit.Kit, tx *gen.Query, lock *table.ResourceLock) error
}

LockDao supplies all the lock operations. NOTICE: the lock must be in the same transaction and database with the operation to lock.

type Publish

type Publish interface {
	// Publish publish an app's release with its strategy.
	// once an app's strategy along with its release id is published,
	// all its released config items are effected immediately.
	Publish(kit *kit.Kit, opt *types.PublishOption) (id uint32, err error)

	PublishWithTx(kit *kit.Kit, tx *gen.QueryTx, opt *types.PublishOption) (id uint32, err error)

	SubmitWithTx(kit *kit.Kit, tx *gen.QueryTx, opt *types.PublishOption) (id uint32, err error)

	UpsertPublishWithTx(kit *kit.Kit, tx *gen.QueryTx, opt *types.PublishOption, stg *table.Strategy) error
}

Publish defines all the publish operation related operations.

type Release

type Release interface {
	// CreateWithTx create one release instance with tx.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, release *table.Release) (uint32, error)
	// List releases with options.
	List(kit *kit.Kit, opts *types.ListReleasesOption) (*types.ListReleaseDetails, error)
	// ListAllByIDs list all releases by releaseIDs.
	ListAllByIDs(kit *kit.Kit, ids []uint32, bizID uint32) ([]*table.Release, error)
	// GetByName get release by name
	GetByName(kit *kit.Kit, bizID uint32, appID uint32, name string) (*table.Release, error)
	// Get get release by id
	Get(kit *kit.Kit, bizID, appID, releaseID uint32) (*table.Release, error)
	// UpdateDeprecated update release deprecated status.
	UpdateDeprecated(kit *kit.Kit, bizID, appID, releaseID uint32, deprecated bool) error
	// DeleteWithTx delete release with tx.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID, releaseID uint32) error
	// GetReleaseLately get release lately info
	GetReleaseLately(kit *kit.Kit, bizID uint32, appID uint32) (*table.Release, error)
	// ListReleaseStrategies list release strategie the latest three pieces of data published
	ListReleaseStrategies(kit *kit.Kit, bizID uint32, appID uint32) ([]*types.ListReleasesStrategies, error)
}

Release supplies all the release related operations.

type ReleasedAppTemplate

type ReleasedAppTemplate interface {
	// BulkCreateWithTx bulk create released template config items.
	BulkCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, items []*table.ReleasedAppTemplate) error
	// Get released app template.
	Get(kit *kit.Kit, bizID, appID, releaseID, tmplRevisionID uint32) (*table.ReleasedAppTemplate, error)
	// List released app templates with options.
	List(kit *kit.Kit, bizID, appID, releaseID uint32, s search.Searcher, opt *types.BasePage, searchValue string) (
		[]*table.ReleasedAppTemplate, int64, error)
	// GetReleasedLately get released templates lately
	GetReleasedLately(kit *kit.Kit, bizID, appID uint32) ([]*table.ReleasedAppTemplate, error)
	// BatchDeleteByAppIDWithTx batch delete by app id with transaction.
	BatchDeleteByAppIDWithTx(kit *kit.Kit, tx *gen.QueryTx, appID, bizID uint32) error
	// BatchDeleteByReleaseIDWithTx batch delete by release id with transaction.
	BatchDeleteByReleaseIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID, releaseID uint32) error
	// ListAllCISigns lists all released template ci signatures of one biz, and only belongs to existing apps
	ListAllCISigns(kit *kit.Kit, bizID uint32) ([]string, error)
}

ReleasedAppTemplate supplies all the released app template related operations.

type ReleasedAppTemplateVariable

type ReleasedAppTemplateVariable interface {
	// CreateWithTx create one app template variable instance with transaction.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, variable *table.ReleasedAppTemplateVariable) (uint32, error)
	// ListVariables lists all variables in released app template variable
	ListVariables(kit *kit.Kit, bizID, appID, releaseID uint32) ([]*table.TemplateVariableSpec, error)
	// BatchDeleteByAppIDWithTx batch delete by app id with transaction.
	BatchDeleteByAppIDWithTx(kit *kit.Kit, tx *gen.QueryTx, appID, bizID uint32) error
	// BatchDeleteByReleaseIDWithTx batch delete by release id with transaction.
	BatchDeleteByReleaseIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID, releaseID uint32) error
}

ReleasedAppTemplateVariable supplies all the template revision related operations.

type ReleasedCI

type ReleasedCI interface {
	// BulkCreateWithTx bulk create released config items with tx.
	BulkCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, items []*table.ReleasedConfigItem) error
	// Get released config item.
	Get(kit *kit.Kit, bizID, appID, releasedID, configItemID uint32) (*table.ReleasedConfigItem, error)
	// GetReleasedLately get released config items lately.
	GetReleasedLately(kit *kit.Kit, bizID, appId uint32) ([]*table.ReleasedConfigItem, error)
	// List released config items with options.
	List(kit *kit.Kit, bizID, appID, releaseID uint32, s search.Searcher, opt *types.BasePage, searchValue string) (
		[]*table.ReleasedConfigItem, int64, error)
	// ListAll list all released config items in biz.
	ListAll(kit *kit.Kit, bizID uint32) ([]*table.ReleasedConfigItem, error)
	// ListAllByAppID list all released config items by appID.
	ListAllByAppID(kit *kit.Kit, appID, bizID uint32) ([]*table.ReleasedConfigItem, error)
	// ListAllByAppIDs batch list released config items by appIDs.
	ListAllByAppIDs(kit *kit.Kit, appIDs []uint32, bizID uint32) ([]*table.ReleasedConfigItem, error)
	// ListAllByReleaseIDs batch list released config items by releaseIDs.
	ListAllByReleaseIDs(kit *kit.Kit, releasedIDs []uint32, bizID uint32) ([]*table.ReleasedConfigItem, error)
	// BatchDeleteByReleaseIDWithTx batch delete by release id with transaction.
	BatchDeleteByReleaseIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID, releaseID uint32) error
	// ListAllCISigns lists all released non-template ci signatures of one biz, and only belongs to existing apps
	ListAllCISigns(kit *kit.Kit, bizID uint32) ([]string, error)
}

ReleasedCI supplies all the released config item related operations.

type ReleasedGroup

type ReleasedGroup interface {
	// ListAll list all released groups in biz
	ListAll(kit *kit.Kit, bizID uint32) ([]*table.ReleasedGroup, error)
	// ListAllByGroupID list all released groups by groupID
	ListAllByGroupID(kit *kit.Kit, groupID, bizID uint32) ([]*table.ReleasedGroup, error)
	// ListAllByAppID list all released groups by appID
	ListAllByAppID(kit *kit.Kit, appID, bizID uint32) ([]*table.ReleasedGroup, error)
	// ListAllByReleaseID list all released groups by releaseID
	ListAllByReleaseID(kit *kit.Kit, releaseID, bizID uint32) ([]*table.ReleasedGroup, error)
	// CountGroupsReleasedApps counts each group's published apps.
	CountGroupsReleasedApps(kit *kit.Kit, opts *types.CountGroupsReleasedAppsOption) (
		[]*types.GroupPublishedAppsCount, error)
	// UpdateEditedStatusWithTx update edited status with transaction
	UpdateEditedStatusWithTx(kit *kit.Kit, tx *gen.QueryTx, edited bool, groupID, bizID uint32) error
	// BatchDeleteByAppIDWithTx batch delete by app id with transaction.
	BatchDeleteByAppIDWithTx(kit *kit.Kit, tx *gen.QueryTx, appID, bizID uint32) error
}

ReleasedGroup supplies all the group related operations.

type ReleasedHook

type ReleasedHook interface {
	// UpsertWithTx upserts the released hook with transaction.
	UpsertWithTx(kit *kit.Kit, tx *gen.QueryTx, rh *table.ReleasedHook) error
	// UpdateHookRevisionByReleaseIDWithTx updates the hook's revision info by release id with transaction.
	UpdateHookRevisionByReleaseIDWithTx(kit *kit.Kit, tx *gen.QueryTx,
		bizID, releaseID, hookID uint32, hookRevision *table.HookRevision) error
	// Get gets the released hook.
	Get(kit *kit.Kit, bizID, appID, releaseID uint32, tp table.HookType) (*table.ReleasedHook, error)
	// GetByReleaseID gets the pre hook and post hook by release id.
	GetByReleaseID(kit *kit.Kit, bizID, releaseID uint32) (*table.ReleasedHook, *table.ReleasedHook, error)
	// CreateWithTx creates a new released hook with transaction.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, releasedHook *table.ReleasedHook) (uint32, error)
	// ListAll list all released hooks in biz
	ListAll(kit *kit.Kit, bizID uint32) ([]*table.ReleasedHook, error)
	// DeleteByAppIDWithTx deletes the released hook by app id with transaction.
	DeleteByAppIDWithTx(kit *kit.Kit, tx *gen.QueryTx, appID, bizID uint32) error
	// DeleteByUniqueKeyWithTx deletes the released hook by unique key with transaction.
	DeleteByUniqueKeyWithTx(kit *kit.Kit, tx *gen.QueryTx, rh *table.ReleasedHook) error
	// DeleteByHookIDAndReleaseIDWithTx deletes the released hook by hook id and release id with transaction.
	DeleteByHookIDAndReleaseIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, hookID, releaseID uint32) error
	// CountByHookIDAndReleaseID counts the released hook by hook id and release id.
	CountByHookIDAndReleaseID(kit *kit.Kit, bizID, hookID, releaseID uint32) (int64, error)
	// DeleteByHookRevisionIDAndReleaseIDWithTx deletes the released hook by revision id and release id with tx.
	DeleteByHookRevisionIDAndReleaseIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID,
		hookID, hookRevisionID, releaseID uint32) error
	// CountByHookRevisionIDAndReleaseID counts the released hook by hook revision id and release id.
	CountByHookRevisionIDAndReleaseID(kit *kit.Kit, bizID, hookID, hookRevisionID, releaseID uint32) (int64, error)
	// BatchDeleteByReleaseIDWithTx batch delete by release id with transaction.
	BatchDeleteByReleaseIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID, releaseID uint32) error
}

ReleasedHook supplies all the group related operations.

type ReleasedKv

type ReleasedKv interface {
	// BulkCreateWithTx bulk create released kv with tx.
	BulkCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, kvs []*table.ReleasedKv) error
	// Get released kv.
	Get(kit *kit.Kit, bizID, appID, releasedID uint32, key string) (*table.ReleasedKv, error)
	// List released kv with options.
	List(kit *kit.Kit, opt *types.ListRKvOption) ([]*table.ReleasedKv, int64, error)
	// ListAllByReleaseIDs batch list released kvs by releaseIDs.
	ListAllByReleaseIDs(kit *kit.Kit, releasedIDs []uint32, bizID uint32) ([]*table.ReleasedKv, error)
	// GetReleasedLately get released kv lately
	GetReleasedLately(kit *kit.Kit, bizID, appID uint32) ([]*table.ReleasedKv, error)
	// GetReleasedLatelyByKey get released kv lately by key
	GetReleasedLatelyByKey(kit *kit.Kit, bizID, appID uint32, key string) (*table.ReleasedKv, error)
	// BatchDeleteByReleaseIDWithTx batch delete by release id with transaction.
	BatchDeleteByReleaseIDWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, appID, releaseID uint32) error
}

ReleasedKv supplies all the released kv related operations.

type Set

type Set interface {
	GenQuery() *gen.Query
	ID() IDGenInterface
	App() App
	AuditDao() AuditDao
	Commit() Commit
	ConfigItem() ConfigItem
	Content() Content
	Release() Release
	ReleasedCI() ReleasedCI
	Hook() Hook
	HookRevision() HookRevision
	ReleasedHook() ReleasedHook
	TemplateSpace() TemplateSpace
	Template() Template
	TemplateRevision() TemplateRevision
	TemplateSet() TemplateSet
	AppTemplateBinding() AppTemplateBinding
	ReleasedAppTemplate() ReleasedAppTemplate
	AppTemplateVariable() AppTemplateVariable
	ReleasedAppTemplateVariable() ReleasedAppTemplateVariable
	TemplateBindingRelation() TemplateBindingRelation
	TemplateVariable() TemplateVariable
	Validator() Validator
	Group() Group
	GroupAppBind() GroupAppBind
	ReleasedGroup() ReleasedGroup
	Publish() Publish
	IAM() IAM
	Event() Event
	BeginTx(kit *kit.Kit, bizID uint32) (*sharding.Tx, error)
	Healthz() error
	Credential() Credential
	CredentialScope() CredentialScope
	Kv() Kv
	ReleasedKv() ReleasedKv
	Strategy() Strategy
	Client() Client
	ClientEvent() ClientEvent
	ClientQuery() ClientQuery
	Config() Config
}

Set defines all the DAO to be operated.

func NewDaoSet

func NewDaoSet(opt cc.Sharding, credentialSetting cc.Credential, gormSetting cc.Gorm) (Set, error)

NewDaoSet create the DAO set instance.

type Strategy

type Strategy interface {
	// Get last strategy.
	GetLast(kit *kit.Kit, bizID, appID, releasedID, strategyID uint32) (*table.Strategy, error)
	// GetStrategyByIDs Get strategy by ids.
	GetStrategyByIDs(kit *kit.Kit, strategyIDs []uint32) ([]*table.Strategy, error)
	// ListStrategyByItsm list strategy by itsm.
	ListStrategyByItsm(kit *kit.Kit) ([]*table.Strategy, error)
	// ListStrategyByReleasesIDs list strategy by ReleasesID.
	ListStrategyByReleasesIDs(kit *kit.Kit, releasesIDs []uint32) ([]*table.Strategy, error)
	// UpdateByID update strategy kv by id.
	UpdateByID(kit *kit.Kit, tx *gen.QueryTx, strategyID uint32, m map[string]interface{}) error
	// UpdateByIDs update strategy kv by ids
	UpdateByIDs(
		kit *kit.Kit, tx *gen.QueryTx, strategyID []uint32, m map[string]interface{}) error
}

Strategy supplies all the Strategy related operations.

type Template

type Template interface {
	// Create one template instance.
	Create(kit *kit.Kit, template *table.Template) (uint32, error)
	// CreateWithTx create one template instance with transaction.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, template *table.Template) (uint32, error)
	// Update one template's info.
	Update(kit *kit.Kit, template *table.Template) error
	// UpdateWithTx Update one template instance with transaction.
	UpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, template *table.Template) error
	// List templates with options.
	List(kit *kit.Kit, bizID, templateSpaceID uint32, s search.Searcher,
		opt *types.BasePage, topIds []uint32, searchValue string) ([]*table.Template, int64, error)
	// Delete one template instance.
	Delete(kit *kit.Kit, template *table.Template) error
	// DeleteWithTx delete one template instance with transaction.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, template *table.Template) error
	// GetByUniqueKey get template by unique key.
	GetByUniqueKey(kit *kit.Kit, bizID, templateSpaceID uint32, name, path string) (*table.Template, error)
	// GetByID get template by id.
	GetByID(kit *kit.Kit, bizID, templateID uint32) (*table.Template, error)
	// ListByIDs list templates by template ids.
	ListByIDs(kit *kit.Kit, ids []uint32) ([]*table.Template, error)
	// ListByIDsWithTx list templates by template ids with transaction.
	ListByIDsWithTx(kit *kit.Kit, tx *gen.QueryTx, ids []uint32) ([]*table.Template, error)
	// ListAllIDs list all template ids.
	ListAllIDs(kit *kit.Kit, bizID, templateSpaceID uint32) ([]uint32, error)
	// BatchCreateWithTx batch create template instances with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, templates []*table.Template) error
	// BatchUpdateWithTx batch update template instances with transaction.
	BatchUpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, templates []*table.Template) error
	// ListTemplateByTuple 按照多个字段in查询template 列表
	ListTemplateByTuple(kit *kit.Kit, data [][]interface{}) ([]*table.Template, error)
	// ListByExclusionIDs list templates by template exclusion ids.
	ListByExclusionIDs(kit *kit.Kit, ids []uint32) ([]*table.Template, error)
}

Template supplies all the template related operations.

type TemplateBindingRelation

type TemplateBindingRelation interface {
	// GetTemplateBoundUnnamedAppCount get bound unnamed app count of the target template.
	GetTemplateBoundUnnamedAppCount(kit *kit.Kit, bizID, templateID uint32) (uint32, error)
	// GetTemplateBoundNamedAppCount get bound named app count of the target template.
	GetTemplateBoundNamedAppCount(kit *kit.Kit, bizID, templateID uint32) (uint32, error)
	// GetTemplateBoundTemplateSetCount get bound template set count of the target template.
	GetTemplateBoundTemplateSetCount(kit *kit.Kit, bizID, templateID uint32) (uint32, error)
	// GetTemplateRevisionBoundUnnamedAppCount get bound unnamed app count of the target template release.
	GetTemplateRevisionBoundUnnamedAppCount(kit *kit.Kit, bizID, templateRevisionID uint32) (uint32, error)
	// GetTemplateRevisionBoundNamedAppCount get bound named app count of the target template release.
	GetTemplateRevisionBoundNamedAppCount(kit *kit.Kit, bizID, templateRevisionID uint32) (uint32, error)
	// GetTemplateSetBoundUnnamedAppCount get bound unnamed app count of the target template set.
	GetTemplateSetBoundUnnamedAppCount(kit *kit.Kit, bizID, templateSetID uint32) (uint32, error)
	// GetTemplateSetBoundNamedAppCount get bound named app count of the target template set.
	GetTemplateSetBoundNamedAppCount(kit *kit.Kit, bizID, templateSetID uint32) (uint32, error)
	// ListTmplBoundUnnamedApps list bound unnamed app details of the target template.
	ListTmplBoundUnnamedApps(kit *kit.Kit, bizID, templateID uint32) ([]*types.TmplBoundUnnamedAppDetail, error)
	// ListTmplBoundNamedApps list bound named app details of the target template.
	ListTmplBoundNamedApps(kit *kit.Kit, bizID, templateID uint32) ([]*types.TmplBoundNamedAppDetail, error)
	// ListTmplBoundTmplSets list bound template set details of the target template.
	ListTmplBoundTmplSets(kit *kit.Kit, bizID, templateID uint32) ([]uint32, error)
	// ListTmplRevisionBoundUnnamedApps list bound unnamed app details of the target template release.
	ListTmplRevisionBoundUnnamedApps(kit *kit.Kit, bizID, templateRevisionID uint32) ([]uint32, error)
	// ListTmplRevisionBoundNamedApps list bound named app details of the target template release.
	ListTmplRevisionBoundNamedApps(kit *kit.Kit, bizID, templateRevisionID uint32) (
		[]*types.TmplRevisionBoundNamedAppDetail, error)
	// ListTmplSetBoundUnnamedApps list bound unnamed app details of the target template set.
	ListTmplSetBoundUnnamedApps(kit *kit.Kit, bizID, templateSetID uint32) ([]uint32, error)
	// ListTmplSetBoundNamedApps list bound named app details of the target template set.
	ListTmplSetBoundNamedApps(kit *kit.Kit, bizID, templateSetID uint32) ([]*types.TmplSetBoundNamedAppDetail, error)
	// ListLatestTmplBoundUnnamedApps list bound unnamed app details of the latest target template.
	ListLatestTmplBoundUnnamedApps(kit *kit.Kit, bizID, templateID uint32) ([]*table.AppTemplateBinding, error)
	// ListTemplateSetsBoundATBs list bound app template bindings of the target template sets.
	ListTemplateSetsBoundATBs(kit *kit.Kit, bizID uint32, templateSetIDs []uint32) ([]*table.AppTemplateBinding, error)
	// ListTemplatesBoundATBs list bound app template bindings of the target templates.
	ListTemplatesBoundATBs(kit *kit.Kit, bizID uint32, templateIDs []uint32) ([]*table.AppTemplateBinding, error)
	// ListTemplateSetInvisibleATBs list invisible atbs of the target template set when update its app visible scope.
	ListTemplateSetInvisibleATBs(kit *kit.Kit, bizID, templateSetID uint32, boundApps []uint32) (
		[]*table.AppTemplateBinding, error)
}

TemplateBindingRelation supplies all the template binding relation query operations.

type TemplateRevision

type TemplateRevision interface {
	// Create one template revision instance.
	Create(kit *kit.Kit, templateRevision *table.TemplateRevision) (uint32, error)
	// CreateWithTx create one template revision instance with transaction.
	CreateWithTx(kit *kit.Kit, tx *gen.QueryTx, template *table.TemplateRevision) (uint32, error)
	// List templates with options.
	List(kit *kit.Kit, bizID, templateID uint32, s search.Searcher, opt *types.BasePage) ([]*table.TemplateRevision,
		int64, error)
	// Delete one template revision instance.
	Delete(kit *kit.Kit, templateRevision *table.TemplateRevision) error
	// GetByUniqueKey get template revision by unique key.
	GetByUniqueKey(kit *kit.Kit, bizID, templateID uint32, revisionName string) (*table.TemplateRevision, error)
	// ListByIDs list template revisions by template revision ids.
	ListByIDs(kit *kit.Kit, ids []uint32) ([]*table.TemplateRevision, error)
	// ListByIDsWithTx list template revisions by template revision ids with transaction.
	ListByIDsWithTx(kit *kit.Kit, tx *gen.QueryTx, ids []uint32) ([]*table.TemplateRevision, error)
	// ListByTemplateIDs list template revisions by template ids.
	ListByTemplateIDs(kit *kit.Kit, bizID uint32, templateIDs []uint32) ([]*table.TemplateRevision, error)
	// ListByTemplateIDsWithTx list template revisions by template ids with transaction.
	ListByTemplateIDsWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID uint32, templateIDs []uint32) (
		[]*table.TemplateRevision, error)
	// DeleteForTmplWithTx delete template revision for one template with transaction.
	DeleteForTmplWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, templateID uint32) error
	// BatchCreateWithTx batch create template revisions instances with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, revisions []*table.TemplateRevision) error
	// ListLatestRevisionsGroupByTemplateIds Lists the latest version groups by template ids
	ListLatestRevisionsGroupByTemplateIds(kit *kit.Kit, templateIDs []uint32) ([]*table.TemplateRevision, error)
	// GetLatestTemplateRevision get latest template revision.
	GetLatestTemplateRevision(kit *kit.Kit, bizID, templateID uint32) (*table.TemplateRevision, error)
	// GetTemplateRevisionById get template revision by id.
	GetTemplateRevisionById(kit *kit.Kit, bizID, id uint32) (*table.TemplateRevision, error)
	// ListLatestGroupByTemplateIdsWithTx Lists the latest version groups by template ids with transaction.
	ListLatestGroupByTemplateIdsWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID uint32,
		templateIDs []uint32) ([]*table.TemplateRevision, error)
	// ListAllCISigns lists all template ci of one biz, no need care about apps for the unbound template ci
	ListAllCISigns(kit *kit.Kit, bizID uint32) ([]string, error)
}

TemplateRevision supplies all the template revision related operations.

type TemplateSet

type TemplateSet interface {
	// Create one template set instance.
	Create(kit *kit.Kit, templateSet *table.TemplateSet) (uint32, error)
	// Update one template set's info.
	Update(kit *kit.Kit, templateSet *table.TemplateSet) error
	// UpdateWithTx update one template set's info with transaction.
	UpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, templateSet *table.TemplateSet) error
	// List template sets with options.
	List(kit *kit.Kit, bizID, templateSpaceID uint32, s search.Searcher, opt *types.BasePage) (
		[]*table.TemplateSet, int64, error)
	// Delete one template set instance.
	Delete(kit *kit.Kit, templateSet *table.TemplateSet) error
	// DeleteWithTx delete one template set instance with transaction.
	DeleteWithTx(kit *kit.Kit, tx *gen.QueryTx, templateSet *table.TemplateSet) error
	// GetByUniqueKey get template set by unique key.
	GetByUniqueKey(kit *kit.Kit, bizID, templateSpaceID uint32, name string) (*table.TemplateSet, error)
	// GetByUniqueKeyForUpdate get template set by unique key for update which allow to update name.
	GetByUniqueKeyForUpdate(kit *kit.Kit, bizID, templateSpaceID, selfID uint32, name string) (
		*table.TemplateSet, error)
	// ListByIDs list template sets by template set ids.
	ListByIDs(kit *kit.Kit, ids []uint32) ([]*table.TemplateSet, error)
	// ListByIDsWithTx list template sets by template set ids with transaction.
	ListByIDsWithTx(kit *kit.Kit, tx *gen.QueryTx, ids []uint32) ([]*table.TemplateSet, error)
	// AddTmplsToTmplSetsWithTx add templates to template sets with transaction.
	AddTmplsToTmplSetsWithTx(kit *kit.Kit, tx *gen.QueryTx, tmplIDs []uint32, tmplSetIDs []uint32) error
	// DeleteTmplsFromTmplSetsWithTx delete templates from template sets with transaction.
	DeleteTmplsFromTmplSetsWithTx(kit *kit.Kit, tx *gen.QueryTx, tmplIDs []uint32, tmplSetIDs []uint32) error
	// AddTmplToTmplSetsWithTx add a template to template sets with transaction.
	AddTmplToTmplSetsWithTx(kit *kit.Kit, tx *gen.QueryTx, tmplID uint32, tmplSetIDs []uint32) error
	// DeleteTmplFromAllTmplSetsWithTx delete a template from all template sets with transaction.
	DeleteTmplFromAllTmplSetsWithTx(kit *kit.Kit, tx *gen.QueryTx, bizID, tmplID uint32) error
	// ListAppTmplSets list all the template sets of the app.
	ListAppTmplSets(kit *kit.Kit, bizID, appID uint32) ([]*table.TemplateSet, error)
	// ListAllTemplateIDs list all template ids of all template sets in one template space.
	ListAllTemplateIDs(kit *kit.Kit, bizID, templateSpaceID uint32) ([]uint32, error)
	// ListAllTmplSetsOfBiz list all template sets of one biz
	ListAllTmplSetsOfBiz(kit *kit.Kit, bizID, appID uint32) ([]*table.TemplateSet, error)
	// ValidateTmplNumber verify whether the current number of template set's templates has reached the maximum.
	ValidateTmplNumber(kt *kit.Kit, tx *gen.QueryTx, bizID, tmplSetID uint32) error
	// ValidateWillExceedMaxTmplCount 给定一个数 和当前数量相加, 判断是否超过最大限制
	ValidateWillExceedMaxTmplCount(kt *kit.Kit, tx *gen.QueryTx, bizID,
		tmplSetID uint32, number int) error
	// GetByTemplateSetByID get template set by id
	GetByTemplateSetByID(kit *kit.Kit, bizID, id uint32) (*table.TemplateSet, error)
	// BatchAddTmplsToTmplSetsWithTx 批量添加至某个套餐中
	BatchAddTmplsToTmplSetsWithTx(kit *kit.Kit, tx *gen.QueryTx, templateSet []*table.TemplateSet) error
	// ListByTemplateSpaceIdAndIds list template sets by template set ids and template_space_id.
	ListByTemplateSpaceIdAndIds(kit *kit.Kit, templateSpaceID uint32, ids []uint32) ([]*table.TemplateSet, error)
}

TemplateSet supplies all the template set related operations.

type TemplateSpace

type TemplateSpace interface {
	// Create one template space instance.
	Create(kit *kit.Kit, templateSpace *table.TemplateSpace) (uint32, error)
	// Update one template space's info.
	Update(kit *kit.Kit, templateSpace *table.TemplateSpace) error
	// List template spaces with options.
	List(kit *kit.Kit, bizID uint32, s search.Searcher, opt *types.BasePage) ([]*table.TemplateSpace, int64, error)
	// Delete one template space instance.
	Delete(kit *kit.Kit, templateSpace *table.TemplateSpace) error
	// GetByUniqueKey get template space by unique key.
	GetByUniqueKey(kit *kit.Kit, bizID uint32, name string) (*table.TemplateSpace, error)
	// GetAllBizs get all biz ids of template spaces.
	GetAllBizs(kit *kit.Kit) ([]uint32, error)
	// CreateDefault create default template space instance together with its default template set instance
	CreateDefault(kit *kit.Kit, bizID uint32) (uint32, error)
	// ListByIDs list template spaces by template space ids.
	ListByIDs(kit *kit.Kit, ids []uint32) ([]*table.TemplateSpace, error)
}

TemplateSpace supplies all the template space related operations.

type TemplateVariable

type TemplateVariable interface {
	// Create one template variable instance.
	Create(kit *kit.Kit, templateVariable *table.TemplateVariable) (uint32, error)
	// Update one template variable's info.
	Update(kit *kit.Kit, templateVariable *table.TemplateVariable) error
	// List template variables with options.
	List(kit *kit.Kit, bizID uint32, s search.Searcher, opt *types.BasePage) ([]*table.TemplateVariable, int64, error)
	// Delete one template variable instance.
	Delete(kit *kit.Kit, templateVariable *table.TemplateVariable) error
	// BatchCreateWithTx batch create variable instances with transaction.
	BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, tmplVars []*table.TemplateVariable) error
	// BatchUpdateWithTx batch update variable instances with transaction.
	BatchUpdateWithTx(kit *kit.Kit, tx *gen.QueryTx, tmplVars []*table.TemplateVariable) error
	// GetByUniqueKey get template variable by unique key.
	GetByUniqueKey(kit *kit.Kit, bizID uint32, name string) (*table.TemplateVariable, error)
	// FetchIDsExcluding 获取指定ID后排除的ID
	FetchIDsExcluding(kit *kit.Kit, bizID uint32, ids []uint32) ([]uint32, error)
}

TemplateVariable supplies all the template variable related operations.

type Validator

type Validator interface {
	// ValidateTmplSpacesExist validate if templates spaces exists
	ValidateTmplSpacesExist(kit *kit.Kit, templateSpaceIDs []uint32) error
	// ValidateTemplatesExist validate if templates exists
	ValidateTemplatesExist(kit *kit.Kit, templateIDs []uint32) error
	// ValidateTmplRevisionsExist validate if template releases exists
	ValidateTmplRevisionsExist(kit *kit.Kit, templateRevisionIDs []uint32) error
	// ValidateTmplRevisionsExistWithTx validate if template releases exists with transaction
	ValidateTmplRevisionsExistWithTx(kit *kit.Kit, tx *gen.QueryTx, templateRevisionIDs []uint32) error
	// ValidateTmplSetsExist validate if template sets exists
	ValidateTmplSetsExist(kit *kit.Kit, templateSetIDs []uint32) error
	// ValidateTemplateExist validate if one template exists
	ValidateTemplateExist(kit *kit.Kit, id uint32) error
	// ValidateTmplRevisionExist validate if one template release exists
	ValidateTmplRevisionExist(kit *kit.Kit, id uint32) error
	// ValidateTmplSetExist validate if one template set exists
	ValidateTmplSetExist(kit *kit.Kit, id uint32) error
	// ValidateTmplSpaceNoSubRes validate if one template space has not subresource
	ValidateTmplSpaceNoSubRes(kit *kit.Kit, id uint32) error
	// ValidateTmplsBelongToTmplSet validate if templates belong to a template set
	ValidateTmplsBelongToTmplSet(kit *kit.Kit, templateIDs []uint32, templateSetID uint32) error
}

Validator supplies all the validate operations.

Jump to

Keyboard shortcuts

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