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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type IDefaultAttributeCreator

type IDefaultAttributeCreator interface {
	CreateDefaultAttribute(ctx context.Context, modelUid string) (int64, error)
}

IDefaultAttributeCreator 创建模型时初始化默认属性的能力接口 NOTE: 接口反转设计——model 模块仅依赖自定义的窄接口,由 attribute 模块的 Service 提供实现

type IDeleteModelDependencyChecker

type IDeleteModelDependencyChecker interface {
	// CheckBeforeDelete 深度校验模型是否可删除,若已被使用则返回 error
	CheckBeforeDelete(ctx context.Context, modelUid string) error
}

IDeleteModelDependencyChecker 多维度依赖探测接口,各子模块注册以在删除模型前实施级联阻断校验

type MGService

type MGService interface {
	// Create 创建模型分组
	Create(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, int64, error)

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

	// Rename 根据 ID 重命名模型组
	Rename(ctx context.Context, id int64, name string) (int64, error)
}

func NewMGService

func NewMGService(repo repository.MGRepository, modelRepo repository.ModelRepository) MGService

type Service

type Service interface {
	// Create 创建模型
	Create(ctx context.Context, req domain.Model) (int64, error)

	// CreateModelWithDefaults 创建模型并初始化默认属性(原子化编排)
	CreateModelWithDefaults(ctx context.Context, req domain.Model) (int64, error)

	// List 获取模型列表、带有分页
	List(ctx context.Context, offset, limit int64) ([]domain.Model, int64, error)

	// ListAll 获取所有模型
	ListAll(ctx context.Context) ([]domain.Model, error)

	// GetByUids 根据唯一标识检索模型列表
	GetByUids(ctx context.Context, uids []string) ([]domain.Model, error)

	// GetByUid 根据唯一标识获取模型详情
	GetByUid(ctx context.Context, uid string) (domain.Model, error)

	// DeleteById 根据ID删除指定模型
	DeleteById(ctx context.Context, id int64) (int64, error)

	// DeleteByModelUid 根据唯一标识删除指定模型
	DeleteByModelUid(ctx context.Context, modelUid string) (int64, error)

	// FindModelById 根据ID 检索模型
	FindModelById(ctx context.Context, id int64) (domain.Model, error)

	// ListModelByGroupIds  获取指定组下的所有模型
	ListModelByGroupIds(ctx context.Context, mgids []int64) ([]domain.Model, error)
}

Jump to

Keyboard shortcuts

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