Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ProviderSet = wire.NewSet( NewModels, NewI18nFromResources, NewOpenAPIFromResources, NewMigrations, )
ProviderSet 收集宿主模块和独立资源,并派生模型、国际化、OpenAPI 和迁移资源快照。
Functions ¶
This section is empty.
Types ¶
type I18n ¶
type I18n []ResourcesItem
I18n 是模块国际化文件资源集合。
func NewI18nFromResources ¶
NewI18nFromResources 收集模块资源中的国际化文件系统。
type Migration ¶
type Migration struct {
// Name 是迁移模块的稳定标识。
Name string
// FS 是迁移脚本所在的文件系统。
FS fs.FS
// Path 是迁移版本目录在文件系统中的根路径。
Path string
// Dependencies 是当前迁移模块依赖的其他迁移模块名称。
Dependencies []string
}
Migration 描述一个模块提供的版本化数据库迁移资源。
type Migrations ¶
type Migrations []Migration
Migrations 是模块数据库迁移资源集合。
func NewMigrations ¶
func NewMigrations(resources Resources) Migrations
NewMigrations 收集模块资源中的数据库迁移资源。
type Module ¶
type Module interface {
// RegisterGRPC 将模块 gRPC 服务注册到宿主。
RegisterGRPC(grpc.ServiceRegistrar)
// RegisterHTTP 将模块 HTTP 服务注册到宿主。
RegisterHTTP(*http.Server)
// RegisterMCP 将模块 MCP 工具注册到宿主。
RegisterMCP(*mcp.Server)
}
Module 定义宿主业务模块向 Core 提供的协议注册能力。
type Modules ¶
type Modules []Module
Modules 聚合多个宿主业务模块,并统一转发协议注册。
func (Modules) RegisterGRPC ¶
func (modules Modules) RegisterGRPC(registrar grpc.ServiceRegistrar)
RegisterGRPC 将全部模块 gRPC 服务注册到宿主。
func (Modules) RegisterHTTP ¶
RegisterHTTP 将全部模块 HTTP 路由注册到宿主。
func (Modules) RegisterMCP ¶
RegisterMCP 将全部模块 MCP 工具注册到宿主。
type OpenAPI ¶
type OpenAPI []ResourcesItem
OpenAPI 是模块 OpenAPI 文档资源集合。
func NewOpenAPIFromResources ¶
NewOpenAPIFromResources 收集模块资源中的 OpenAPI 文件系统。
type Resource ¶ added in v0.0.6
type Resource interface {
// ProjectKey 是宿主项目的稳定标识,用于 OpenAPI 命名空间;留空时使用 kratos-core。
ProjectKey() string
// ProjectName 是宿主项目展示名称,留空时使用 ProjectKey。
ProjectName() string
// Models 是宿主数据库自动迁移所需的模型。
Models() Models
// I18n 是宿主项目语言 JSON 文件系统,文件名应使用 locale 标识。
I18n() fs.FS
// OpenAPI 是宿主项目生成的 Swagger/OpenAPI 文件系统集合,包含默认 openapi.yaml 和可选的 openapi.<locale>.yaml。
OpenAPI() fs.FS
// Migrations 是宿主提供的数据库迁移资源。
Migrations() Migrations
}
Resource 定义宿主向 Core 提供的一组静态资源。
Click to show internal directories.
Click to hide internal directories.