service

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDependency = errors.New("存在关联数据")

Functions

This section is empty.

Types

type RelationModelService

type RelationModelService interface {
	// CreateModelRelation 创建模型关联关系
	CreateModelRelation(ctx context.Context, req domain.ModelRelation) (int64, error)

	// BatchCreate 批量创建模型关联关系
	BatchCreate(ctx context.Context, relations []domain.ModelRelation) error

	// DeleteModelRelation 删除模型关联关系
	DeleteModelRelation(ctx context.Context, id int64) (int64, error)

	// GetByRelationNames 根据唯一标识获取数据
	GetByRelationNames(ctx context.Context, names []string) ([]domain.ModelRelation, error)

	// ListModelUidRelation 根据模型 UID 获取。支持分页
	ListModelUidRelation(ctx context.Context, offset, limit int64, modelUid string) (
		[]domain.ModelRelation, int64, error)

	// CountByModelUid 根据模型 UID 获取数量
	CountByModelUid(ctx context.Context, modelUid string) (int64, error)

	// FindModelDiagramBySrcUids 查询模型关联关系,绘制拓扑图
	FindModelDiagramBySrcUids(ctx context.Context, srcUids []string) ([]domain.ModelDiagram, error)

	// CountByRelationTypeUID 根据关联类型 UID 获取数量
	CountByRelationTypeUID(ctx context.Context, uid string) (int64, error)

	// UpdateModelRelation 更新模型关联关系
	UpdateModelRelation(ctx context.Context, req domain.ModelRelation) (int64, error)

	// CheckBeforeDelete 检查模型是否被关联配置使用,有则拦截
	CheckBeforeDelete(ctx context.Context, modelUid string) error
}

RelationModelService 模型关联关系服务接口

type RelationResourceService

type RelationResourceService interface {
	// CreateResourceRelation 创建资源关联关系
	CreateResourceRelation(ctx context.Context, req domain.ResourceRelation) (int64, error)

	// ListSrcResources 查询资源关联列表
	ListSrcResources(ctx context.Context, modelUid string, id int64) ([]domain.ResourceRelation, int64, error)
	// ListDstResources 查询目标端关联资产列表
	ListDstResources(ctx context.Context, modelUid string, id int64) ([]domain.ResourceRelation, int64, error)

	// ListDiagram 通过 model_uid 和 resource_id 查询 SRC 和 DST 的数据
	ListDiagram(ctx context.Context, modelUid string, id int64) (domain.ResourceDiagram, int64, error)

	// ListDstAggregated 聚合查询目标关联列表
	ListDstAggregated(ctx context.Context, modelUid string, id int64) ([]domain.ResourceAggregatedAssets, error)
	// ListSrcAggregated 聚合查询源端关联列表
	ListSrcAggregated(ctx context.Context, modelUid string, id int64) ([]domain.ResourceAggregatedAssets, error)

	// ListSrcRelated 查询当前已经关联的数据,新增资源关联使用
	ListSrcRelated(ctx context.Context, modelUid, relationName string, id int64) ([]int64, error)

	// ListDstRelated 查询当前已经关联的目标数据,新增资源关联使用
	ListDstRelated(ctx context.Context, modelUid, relationName string, id int64) ([]int64, error)

	// DeleteResourceRelation 删除资源关联关系
	DeleteResourceRelation(ctx context.Context, id int64) (int64, error)

	// DeleteResourceRelationByName 根据关联名称和资源信息删除资产关联关系
	DeleteResourceRelationByName(ctx context.Context, resourceId int64, modelUid, relationName string) (int64, error)

	// DeleteSrcRelation 删除源端关系
	DeleteSrcRelation(ctx context.Context, resourceId int64, modelUid, relationName string) (int64, error)
	// DeleteDstRelation 删除目标端关系
	DeleteDstRelation(ctx context.Context, resourceId int64, modelUid, relationName string) (int64, error)

	// CountByRelationTypeUID 根据关联类型 UID 获取数量
	CountByRelationTypeUID(ctx context.Context, uid string) (int64, error)

	// ListRecursiveDiagram 递归获取多级关联拓扑(支持最大深度)
	ListRecursiveDiagram(ctx context.Context, modelUid string, id int64, maxDepth int) (domain.ResourceDiagram, error)
}

RelationResourceService 资源实例关联关系服务接口

type RelationTypeService

type RelationTypeService interface {
	// Create 创建关联类型
	Create(ctx context.Context, req domain.RelationType) (int64, error)

	// GetByUids 根据 UID 获取关联类型
	GetByUids(ctx context.Context, uids []string) ([]domain.RelationType, error)

	// BatchCreate 批量创建
	BatchCreate(ctx context.Context, rts []domain.RelationType) error

	// List 获取关联类型列表
	List(ctx context.Context, offset, limit int64) ([]domain.RelationType, int64, error)

	// Update 更新关联类型
	Update(ctx context.Context, req domain.RelationType) (int64, error)

	// Delete 删除关联类型
	Delete(ctx context.Context, id int64) (int64, error)
}

RelationTypeService 关联类型服务接口

Jump to

Keyboard shortcuts

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