loader

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ENTRY_JSON = "entry.json"

Variables

This section is empty.

Functions

func GetBase

func GetBase(ctx context.Context) string

GetBase 获取 loader 的 base path

func GetLogID

func GetLogID(ctx context.Context) string

GetLogID 获取 LogID

func GetScope

func GetScope(ctx context.Context) map[string]any

GetScope 获取 loader 的查询范围

func ResetDefaultGroup

func ResetDefaultGroup(groups map[string]source.Group) source.Group

func ResolveExtends added in v1.1.2

func ResolveExtends(ctx context.Context, ldr ILoader, name string, value *source.Value) (*source.Value, error)

ResolveExtends 运行时(DB loader)按 extra.extends 从父模型补齐物理表/索引。

func WithBase

func WithBase(ctx context.Context, base string) context.Context

WithBase 设置 loader 的 base path(用于 JSON/EMBED)

func WithExtendsLoader added in v1.1.2

func WithExtendsLoader(ctx context.Context, fn ExtendsLoader) context.Context

WithExtendsLoader 注册 extends 父模型加载器(embed 场景由 entry.LoadEmbedSource 提供)。

func WithLogID

func WithLogID(ctx context.Context, logID string) context.Context

WithLogID 设置 LogID(统一日志使用)

func WithScope

func WithScope(ctx context.Context, scope map[string]any) context.Context

WithScope 设置 loader 的查询范围(用于 MYSQL/MONGO)

Types

type EmbedLoader

type EmbedLoader struct {
	JSONLoader
	// contains filtered or unexported fields
}

func (*EmbedLoader) Init

func (self *EmbedLoader) Init() error

func (*EmbedLoader) Load

func (self *EmbedLoader) Load(ctx context.Context, name string) (*source.Value, error)

type ExtendsLoader added in v1.1.2

type ExtendsLoader func(ctx context.Context, model string) (*source.Value, error)

ExtendsLoader 按 model 名加载父模型 schema(与运行时 GetSource 同源,不依赖 bundle 目录)。

func GetExtendsLoader added in v1.1.2

func GetExtendsLoader(ctx context.Context) ExtendsLoader

GetExtendsLoader 获取 extends 父模型加载器

type ILoader

type ILoader interface {
	Load(ctx context.Context, model string) (*source.Value, error)
}

func NewLoader

func NewLoader(name string) ILoader

type JSONLoader

type JSONLoader struct {
	// contains filtered or unexported fields
}

func (*JSONLoader) Init

func (self *JSONLoader) Init() error

func (*JSONLoader) Load

func (self *JSONLoader) Load(ctx context.Context, name string) (*source.Value, error)

type SchemaTableName

type SchemaTableName struct {
	Model string
	Table string
	Input string
	XRule string

	Field string
	Group string
}

Jump to

Keyboard shortcuts

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