service

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 9 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 EncryptedSvc

type EncryptedSvc = Service

type Service

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

	// BatchCreateOrUpdate 批量创建或修改资产
	BatchCreateOrUpdate(ctx context.Context, rs []domain.Resource) 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,
		int64, error)

	CountByModelUid(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)

	// ListResourceByIds 资源关联关系调用,查询关联数据
	ListResourceByIds(ctx context.Context, fields []string, ids []int64) ([]domain.Resource, error)

	// ListExcludeAndFilterResourceByIds 排序以及过滤
	ListExcludeAndFilterResourceByIds(ctx context.Context, fields []string, modelUid string, offset, limit int64,
		ids []int64, filter domain.Condition) ([]domain.Resource, int64, error)

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

	// CountByModelUids 聚合查看模型下的数量
	CountByModelUids(ctx context.Context, modelUids []string) (map[string]int, error)

	// Search 全局搜索
	Search(ctx context.Context, text string) ([]domain.SearchResource, error)

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

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

	// BatchUpdateResources 因为资产属性变更,处理改变
	BatchUpdateResources(ctx context.Context, resources []domain.Resource) (int64, error)

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

	// ListAndDecryptBeforeUtime 获取指定时间前的资产列表并解密
	ListAndDecryptBeforeUtime(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, int64, error)

	// CheckBeforeDelete 检查指定模型下是否还有资产实例
	CheckBeforeDelete(ctx context.Context, modelUid string) error
}

func NewService

func NewService(repo repository.ResourceRepository, attrSvc attribute.Service, crypto cryptox.Crypto) Service

Directories

Path Synopsis
Package resourcemocks is a generated GoMock package.
Package resourcemocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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