repository

package
v1.11.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 5 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

This section is empty.

Functions

This section is empty.

Types

type AttributeGroupRepository

type AttributeGroupRepository interface {
	// CreateAttributeGroup 创建属性组
	CreateAttributeGroup(ctx context.Context, req domain.AttributeGroup) (int64, error)

	// BatchCreateAttributeGroup 批量创建组
	BatchCreateAttributeGroup(ctx context.Context, ags []domain.AttributeGroup) ([]domain.AttributeGroup, error)

	// ListAttributeGroup 根据模型唯一标识,获取组信息
	ListAttributeGroup(ctx context.Context, modelUid string) ([]domain.AttributeGroup, error)

	// ListAttributeGroupByIds 根据 IDS 获取组信息
	ListAttributeGroupByIds(ctx context.Context, ids []int64) ([]domain.AttributeGroup, error)

	// DeleteAttributeGroup 删除属性组
	DeleteAttributeGroup(ctx context.Context, id int64) (int64, error)

	// DeleteByModelUid 根据模型唯一标识删除该模型下的所有属性组
	DeleteByModelUid(ctx context.Context, modelUid string) (int64, error)

	// RenameAttributeGroup 重命名属性组
	RenameAttributeGroup(ctx context.Context, id int64, name string) (int64, error)

	// GetMaxSortKeyByModuleUid 获取分组下的最大 SortKey
	GetMaxSortKeyByModuleUid(ctx context.Context, modelUid string) (int64, error)

	// UpdateSort 更新属性组排序
	UpdateSort(ctx context.Context, id int64, sortKey int64) error

	// BatchUpdateSort 批量更新属性组排序
	BatchUpdateSort(ctx context.Context, items []domain.AttributeGroupSortItem) error
}

func NewAttributeGroupRepository

func NewAttributeGroupRepository(dao dao.AttributeGroupDAO) AttributeGroupRepository

type AttributeRepository

type AttributeRepository interface {
	// CreateAttribute 创建模型属性字段
	CreateAttribute(ctx context.Context, req domain.Attribute) (int64, error)

	// BatchCreateAttribute 批量创建模型属性字段
	BatchCreateAttribute(ctx context.Context, attrs []domain.Attribute) error

	// SearchAttributeFieldsByModelUid 根据模型唯一值,排除安全字段
	SearchAttributeFieldsByModelUid(ctx context.Context, modelUid string) ([]string, error)

	// SearchAttributeFieldsBySecure 根据模型唯一值,仅展示安全字段
	SearchAttributeFieldsBySecure(ctx context.Context, modelUid []string) (map[string][]string, error)

	// ListAttributes 根据模型唯一值,搜索所有字段
	ListAttributes(ctx context.Context, modelUID string) ([]domain.Attribute, error)

	// Total 根据模型唯一值,查看字段数量
	Total(ctx context.Context, modelUID string) (int64, error)

	// DeleteAttribute 根据 ID 删除模型字段
	DeleteAttribute(ctx context.Context, id int64) (int64, error)

	// CustomAttributeFieldColumns 自定义展示字段
	CustomAttributeFieldColumns(ctx context.Context, modelUid string, customField []string) (int64, error)

	// CustomAttributeFieldColumnsReverse 变更顺序
	CustomAttributeFieldColumnsReverse(ctx context.Context, modelUid string, customField []string) (int64, error)

	// ListAttributePipeline 根据模型字段分组,进行聚合返回
	ListAttributePipeline(ctx context.Context, modelUid string) ([]domain.AttributePipeline, error)

	// UpdateAttribute 修改属性
	UpdateAttribute(ctx context.Context, req domain.Attribute) (int64, error)

	// DetailAttribute 根据 ID 查看详情属性
	DetailAttribute(ctx context.Context, id int64) (domain.Attribute, error)

	// DeleteByGroupId 根据分组ID删除所有属性
	DeleteByGroupId(ctx context.Context, groupId int64) (int64, error)

	// DeleteByModelUid 根据模型唯一标识删除该模型下的所有属性
	DeleteByModelUid(ctx context.Context, modelUid string) (int64, error)

	// ListByGroupID 根据分组ID获取属性列表(按 SortKey 排序)
	ListByGroupID(ctx context.Context, groupId int64) ([]domain.Attribute, error)

	// GetMaxSortKeyByGroupID 获取分组下的最大 SortKey
	GetMaxSortKeyByGroupID(ctx context.Context, groupId int64) (int64, error)

	// UpdateSort 更新属性的分组和排序
	UpdateSort(ctx context.Context, id, groupId, sortKey int64) error

	// BatchUpdateSortKey 批量更新属性的 SortKey
	BatchUpdateSortKey(ctx context.Context, items []domain.AttributeSortItem) error
}

func NewAttributeRepository

func NewAttributeRepository(dao dao.AttributeDAO) AttributeRepository

type MGRepository

type MGRepository interface {
	// CreateModelGroup 创建模型分组
	CreateModelGroup(ctx context.Context, req domain.ModelGroup) (int64, error)

	// BatchCreate 批量创建模型分组
	BatchCreate(ctx context.Context, req []domain.ModelGroup) ([]domain.ModelGroup, error)

	// GetByNames 根据名称查询模型组
	GetByNames(ctx context.Context, names []string) ([]domain.ModelGroup, error)

	// GetByIDs 根据 ID 查询模型组
	GetByIDs(ctx context.Context, ids []int64) ([]domain.ModelGroup, error)

	// GetByName 根据名称查询模型组
	GetByName(ctx context.Context, name string) (domain.ModelGroup, error)

	// List 获取模型组列表
	List(ctx context.Context, offset, limit int64) ([]domain.ModelGroup, error)

	// Total 获取模型组数量
	Total(ctx context.Context) (int64, error)

	// DeleteModelGroup 根据 ID 删除模型组
	DeleteModelGroup(ctx context.Context, id int64) (int64, error)

	// Rename 重命名分组
	Rename(ctx context.Context, id int64, name string) (int64, error)
}

func NewModelGroupRepository

func NewModelGroupRepository(dao dao.ModelGroupDAO) MGRepository

type ModelRepository

type ModelRepository interface {
	Create(ctx context.Context, req domain.Model) (int64, error)
	FindById(ctx context.Context, id int64) (domain.Model, error)
	GetByUid(ctx context.Context, uid string) (domain.Model, error)
	GetByUids(ctx context.Context, uids []string) ([]domain.Model, error)
	List(ctx context.Context, offset, limit int64) ([]domain.Model, error)
	ListAll(ctx context.Context) ([]domain.Model, error)
	Total(ctx context.Context) (int64, error)
	ListByGroupIds(ctx context.Context, mgids []int64) ([]domain.Model, error)
	DeleteById(ctx context.Context, id int64) (int64, error)
	DeleteByUid(ctx context.Context, modelUid string) (int64, error)

	// CountByGroupId 获取指定组下的模型数量
	CountByGroupId(ctx context.Context, GroupId int64) (int64, error)
}

func NewModelRepository

func NewModelRepository(dao dao.ModelDAO) ModelRepository

type PluginRepository

type PluginRepository interface {
	// UpsertPlugin 按插件 UID 创建或更新插件定义,并保留已有自增 ID。
	UpsertPlugin(ctx context.Context, p domain.Plugin) error

	// UpsertBinding 按绑定 UID 创建或更新插件和模型的输入映射关系。
	UpsertBinding(ctx context.Context, b domain.PluginBinding) error

	// UpdateBindingEnabled 更新绑定启停状态。
	UpdateBindingEnabled(ctx context.Context, uid string, enabled bool) error

	// DeleteBinding 删除插件绑定。
	DeleteBinding(ctx context.Context, uid string) error

	// GetBinding 根据绑定 UID 查询插件绑定。
	GetBinding(ctx context.Context, uid string) (domain.PluginBinding, error)

	// GetPlugin 根据插件 UID 查询插件定义。
	GetPlugin(ctx context.Context, uid string) (domain.Plugin, error)

	// ListPlugins 查询插件定义列表。
	ListPlugins(ctx context.Context) ([]domain.Plugin, error)

	// ListBindingsByPluginID 查询插件绑定列表。
	ListBindingsByPluginID(ctx context.Context, pluginID string) ([]domain.PluginBinding, error)

	// ListBindingsByPluginIDs 批量查询插件绑定列表。
	ListBindingsByPluginIDs(ctx context.Context, pluginIDs []string) ([]domain.PluginBinding, error)

	// ListEnabledBindingsByModelUID 查询指定模型启用中的插件绑定。
	ListEnabledBindingsByModelUID(ctx context.Context, modelUID string) ([]domain.PluginBinding, error)

	// ListEnabledBindingsByModelUIDs 批量查询指定模型启用中的插件绑定。
	ListEnabledBindingsByModelUIDs(ctx context.Context, modelUIDs []string) ([]domain.PluginBinding, error)
}

func NewPluginRepository

func NewPluginRepository(dao dao.PluginDAO) PluginRepository

type RelationModelRepository

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

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

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

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

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

	// TotalByModelUid 根据模型 UID 获取数量
	TotalByModelUid(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)

	// GetByID 根据 ID 获取数据
	GetByID(ctx context.Context, id int64) (domain.ModelRelation, error)

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

RelationModelRepository 模型关联关系仓储接口

func NewRelationModelRepository

func NewRelationModelRepository(dao dao.RelationModelDAO) RelationModelRepository

type RelationResourceRepository

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

	// ListSrcResources 查询资源列表
	ListSrcResources(ctx context.Context, modelUid string, id int64) ([]domain.ResourceRelation, error)
	// ListDstResources 根据目标端查询资源关联列表
	ListDstResources(ctx context.Context, modelUid string, id int64) ([]domain.ResourceRelation, error)
	// TotalSrc 根据源端统计关联数量
	TotalSrc(ctx context.Context, modelUid string, id int64) (int64, error)
	// TotalDst 根据目标端统计关联数量
	TotalDst(ctx context.Context, modelUid string, id int64) (int64, error)

	// ListSrcAggregated 聚合查询关联列表
	ListSrcAggregated(ctx context.Context, modelUid string, id int64) ([]domain.ResourceAggregatedAssets, error)
	// ListDstAggregated 聚合查询目标关联列表
	ListDstAggregated(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)

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

	// CountByRelationName 根据关联名称获取数量
	CountByRelationName(ctx context.Context, name string) (int64, error)

	// DeleteResourceRelation 删除资源关联关系
	DeleteResourceRelation(ctx context.Context, id int64) (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)
	// DeleteByResourceId 级联删除指定资产关联的所有关系
	DeleteByResourceId(ctx context.Context, resourceId int64) (int64, error)

	// ListRecursiveSrc 递归查询下游关联资产列表(正向递归)
	ListRecursiveSrc(ctx context.Context, modelUid string, id int64, maxDepth int) ([]domain.ResourceRelation, error)
	// ListRecursiveDst 递归查询上游关联资产列表(反向递归)
	ListRecursiveDst(ctx context.Context, modelUid string, id int64, maxDepth int) ([]domain.ResourceRelation, error)
}

RelationResourceRepository 资源实例关联关系仓储接口

type RelationTypeRepository

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

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

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

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

	// Total 数量
	Total(ctx context.Context) (int64, error)

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

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

	// GetByID 根据 ID 获取关联类型
	GetByID(ctx context.Context, id int64) (domain.RelationType, error)
}

RelationTypeRepository 关联关系类型仓储接口

func NewRelationTypeRepository

func NewRelationTypeRepository(dao dao.RelationTypeDAO) RelationTypeRepository

type ResourceRepository

type ResourceRepository interface {
	// CreateResource 创建资产
	CreateResource(ctx context.Context, req domain.Resource) (int64, error)

	// FindResourceById 根据 ID 获取资产信息
	FindResourceById(ctx context.Context, fields []string, id int64) (domain.Resource, error)

	// ListResource 获取指定模型的资产列表
	ListResource(ctx context.Context, fields []string, modelUid string, offset, limit int64) ([]domain.Resource, error)

	// TotalByModelUid 获取指定模型的资产总数
	TotalByModelUid(ctx context.Context, modelUid string) (int64, error)

	// SetCustomField 设置指定资产的自定义字段值
	SetCustomField(ctx context.Context, id int64, field string, data interface{}) (int64, error)

	// UnsetCustomField 抹除指定模型下所有资产的自定义字段(平铺键)
	UnsetCustomField(ctx context.Context, modelUid string, fieldUid string) (int64, error)

	// ListResourcesByIds 根据 ID 列表批量获取资产
	ListResourcesByIds(ctx context.Context, fields []string, ids []int64) ([]domain.Resource, error)

	// DeleteResource 删除指定资产
	DeleteResource(ctx context.Context, id int64) (int64, error)

	// ListExcludeAndFilterResourceByIds 排除指定 ID 并根据条件过滤资产列表
	ListExcludeAndFilterResourceByIds(ctx context.Context, fields []string, modelUid string, offset, limit int64,
		ids []int64, filter domain.Condition) ([]domain.Resource, error)

	// TotalExcludeAndFilterResourceByIds 排除指定 ID 并根据条件统计资产总数
	TotalExcludeAndFilterResourceByIds(ctx context.Context, modelUid string, ids []int64, filter domain.Condition) (int64, error)

	// SearchStructure 单租户检索模型 Tabs 统计
	SearchStructure(ctx context.Context, text string) ([]domain.AdminSearchStructureModel, error)

	// SearchPagedResources 模型资产全文检索物理分页(支持指定租户或默认租户上下文)
	SearchPagedResources(ctx context.Context, tenantID int64, modelUid string, text string, offset, limit int64) ([]domain.Resource, int64, error)

	// AdminSearchStructure 跨租户检索大盘结构统计
	AdminSearchStructure(ctx context.Context, text string) ([]domain.AdminSearchModelCount, error)

	// FindSecureData 查找指定资产的加密字段数据
	FindSecureData(ctx context.Context, id int64, fieldUid string) (string, error)

	// UpdateResource 更新资产数据
	UpdateResource(ctx context.Context, resource domain.Resource) (int64, error)

	// CountByModelUids 统计多个模型的资产数量
	CountByModelUids(ctx context.Context, modelUids []string) (map[string]int, error)

	// BatchUpdateResources 批量更新资产
	BatchUpdateResources(ctx context.Context, resources []domain.Resource) (int64, error)

	// BatchCreateOrUpdate 批量创建或更新资产
	// 基于 model_uid + name 进行 upsert,name 已存在则更新,不存在则创建
	BatchCreateOrUpdate(ctx context.Context, resources []domain.Resource) error

	// ListBeforeUtime 获取指定时间前的资产列表
	ListBeforeUtime(ctx context.Context, utime int64, fields []string, modelUid string,
		offset, limit int64) ([]domain.Resource, error)

	// ListResourcesWithFilters 根据复杂筛选条件获取资产列表
	ListResourcesWithFilters(ctx context.Context, fields []string, modelUid string, ids []int64, offset, limit int64,
		filterGroups []domain.FilterGroup) ([]domain.Resource, error)

	// TotalResourcesWithFilters 根据复杂筛选条件统计资产数量
	TotalResourcesWithFilters(ctx context.Context, modelUid string, ids []int64, filterGroups []domain.FilterGroup) (int64, error)
}

func NewResourceRepository

func NewResourceRepository(dao dao.ResourceDAO) ResourceRepository

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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