dao

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudAccountDAO added in v0.0.16

type CloudAccountDAO interface {
	Create(ctx context.Context, account *model.CloudAccount) error
	CreateWithTransaction(ctx context.Context, fn func(tx interface{}) error) error
	CreateInTransaction(ctx context.Context, account *model.CloudAccount, tx interface{}) error
	CreateRegionInTransaction(ctx context.Context, region *model.CloudAccountRegion, tx interface{}) error
	DeleteRegionsByAccountIDInTransaction(ctx context.Context, accountID int, tx interface{}) error
	Update(ctx context.Context, account *model.CloudAccount) error
	UpdateWithFields(ctx context.Context, account *model.CloudAccount, fields []string) error
	Delete(ctx context.Context, id int) error
	GetByID(ctx context.Context, id int) (*model.CloudAccount, error)
	GetList(ctx context.Context, req *model.GetCloudAccountListReq) ([]*model.CloudAccount, int64, error)
	UpdateStatus(ctx context.Context, id int, status model.CloudAccountStatus) error
	GetByProviderAndRegion(ctx context.Context, provider model.CloudProvider, region string) ([]*model.CloudAccount, error)
	BatchDelete(ctx context.Context, ids []int) error
	BatchUpdateStatus(ctx context.Context, ids []int, status model.CloudAccountStatus) error
	CheckNameExists(ctx context.Context, name string, provider model.CloudProvider, excludeID int) (bool, error)
	GetByIDs(ctx context.Context, ids []int) ([]*model.CloudAccount, error)
	GetAll(ctx context.Context, provider model.CloudProvider) ([]*model.CloudAccount, error)
}

func NewCloudAccountDAO added in v0.0.16

func NewCloudAccountDAO(db *gorm.DB, logger *zap.Logger) CloudAccountDAO

type CloudAccountRegionDAO added in v0.0.17

type CloudAccountRegionDAO interface {
	Create(ctx context.Context, region *model.CloudAccountRegion) error
	BatchCreate(ctx context.Context, regions []*model.CloudAccountRegion) error
	Update(ctx context.Context, region *model.CloudAccountRegion) error
	Delete(ctx context.Context, id int) error
	GetByID(ctx context.Context, id int) (*model.CloudAccountRegion, error)
	GetList(ctx context.Context, req *model.GetCloudAccountRegionListReq) ([]*model.CloudAccountRegion, int64, error)
	GetByCloudAccountID(ctx context.Context, cloudAccountID int) ([]*model.CloudAccountRegion, error)
	GetByCloudAccountAndRegion(ctx context.Context, cloudAccountID int, region string) (*model.CloudAccountRegion, error)
	UpdateStatus(ctx context.Context, id int, status model.CloudAccountRegionStatus) error
	ClearDefaultRegion(ctx context.Context, cloudAccountID int) error
	GetResourceCountByRegion(ctx context.Context, regionID int) (int64, error)
}

func NewCloudAccountRegionDAO added in v0.0.17

func NewCloudAccountRegionDAO(db *gorm.DB, logger *zap.Logger) CloudAccountRegionDAO

type TreeCloudDAO added in v0.0.16

type TreeCloudDAO interface {
	Create(ctx context.Context, cloud *model.TreeCloudResource) error
	Update(ctx context.Context, cloud *model.TreeCloudResource) error
	UpdateMetadata(ctx context.Context, id int, metadata map[string]interface{}) error
	Delete(ctx context.Context, id int) error
	GetByID(ctx context.Context, id int) (*model.TreeCloudResource, error)
	GetList(ctx context.Context, req *model.GetTreeCloudResourceListReq) ([]*model.TreeCloudResource, int64, error)
	GetByAccountAndInstanceID(ctx context.Context, cloudAccountID int, instanceID string) (*model.TreeCloudResource, error)
	GetByNodeID(ctx context.Context, nodeID int, req *model.GetTreeNodeCloudResourcesReq) ([]*model.TreeCloudResource, error)
	BindTreeNodes(ctx context.Context, cloudID int, treeNodeIds []int) error
	UnBindTreeNodes(ctx context.Context, cloudID int, treeNodeIds []int) error
	BatchGetByIDs(ctx context.Context, ids []int) ([]*model.TreeCloudResource, error)
	BatchCreate(ctx context.Context, clouds []*model.TreeCloudResource) error
	BatchDelete(ctx context.Context, ids []int) error
	UpdateStatus(ctx context.Context, id int, status model.CloudResourceStatus) error
	BatchUpdateStatus(ctx context.Context, ids []int, status model.CloudResourceStatus) error
	CreateSyncHistory(ctx context.Context, history *model.CloudResourceSyncHistory) error
	GetSyncHistoryList(ctx context.Context, req *model.GetCloudResourceSyncHistoryReq) ([]*model.CloudResourceSyncHistory, int64, error)
	CreateChangeLog(ctx context.Context, log *model.CloudResourceChangeLog) error
	GetChangeLogList(ctx context.Context, req *model.GetCloudResourceChangeLogReq) ([]*model.CloudResourceChangeLog, int64, error)
	GetResourcesByRegion(ctx context.Context, regionID int, resourceType model.CloudResourceType) ([]*model.TreeCloudResource, error)
	GetByRegionAndInstanceID(ctx context.Context, regionID int, instanceID string) (*model.TreeCloudResource, error)
}

func NewTreeCloudDAO added in v0.0.16

func NewTreeCloudDAO(db *gorm.DB, logger *zap.Logger) TreeCloudDAO

type TreeLocalDAO

type TreeLocalDAO interface {
	Create(ctx context.Context, local *model.TreeLocalResource) error
	Update(ctx context.Context, local *model.TreeLocalResource) error
	Delete(ctx context.Context, id int) error
	GetByID(ctx context.Context, id int) (*model.TreeLocalResource, error)
	GetList(ctx context.Context, req *model.GetTreeLocalResourceListReq) ([]*model.TreeLocalResource, int64, error)
	GetByIP(ctx context.Context, ip string) (*model.TreeLocalResource, error)
	BindTreeNodes(ctx context.Context, localID int, treeNodeIds []int) error
	UnBindTreeNodes(ctx context.Context, localID int, treeNodeIds []int) error
	BatchGetByIDs(ctx context.Context, ids []int) ([]*model.TreeLocalResource, error)
}

func NewTreeLocalDAO

func NewTreeLocalDAO(db *gorm.DB, logger *zap.Logger) TreeLocalDAO

type TreeNodeDAO

type TreeNodeDAO interface {
	// 基础查询方法
	GetTreeList(ctx context.Context, req *model.GetTreeNodeListReq) ([]*model.TreeNode, int64, error)
	GetNode(ctx context.Context, id int) (*model.TreeNode, error)
	GetChildNodes(ctx context.Context, parentID int) ([]*model.TreeNode, error)
	GetTreeStatistics(ctx context.Context) (*model.TreeNodeStatisticsResp, error)

	// 节点管理方法
	CreateNode(ctx context.Context, node *model.TreeNode) error
	UpdateNode(ctx context.Context, node *model.TreeNode) error
	DeleteNode(ctx context.Context, id int) error

	// 资源管理方法
	BindResource(ctx context.Context, nodeId int, resourceIds []int) error
	UnbindResource(ctx context.Context, nodeId int, resourceId int) error

	// 成员管理方法
	GetNodeMembers(ctx context.Context, nodeId int, memberType string) ([]*model.User, error)
	AddNodeMember(ctx context.Context, nodeId int, userId int, memberType model.TreeNodeMemberType) error
	RemoveNodeMember(ctx context.Context, nodeId int, userId int, memberType model.TreeNodeMemberType) error
}

func NewTreeNodeDAO

func NewTreeNodeDAO(logger *zap.Logger, db *gorm.DB) TreeNodeDAO

Jump to

Keyboard shortcuts

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