Documentation
¶
Overview ¶
Package scan はGoテンプレートをスキャンしてスキーマを推論します。
このパッケージは text/template のASTを解析し、テンプレート内のフィールド参照を追跡して スキーマ木を構築します。推論される型は以下の通り:
- 葉のフィールド: string
- range で使用されるフィールド: []struct{...}
- index で使用されるフィールド: map[string]string
スキャン結果は internal/typing パッケージで型解決されます。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
Name string
Kind Kind
Elem *Field // Slice/Map の要素
Children map[string]*Field // Struct の子
}
Field は推論スキーマ木のノードです。
type Schema ¶
Schema はトップレベル(Params直下)のフィールド集合です。
func ScanTemplate ¶
ScanTemplate は Go テンプレートを AST 解析して、.(ドット)スコープを追跡して フィールド参照からスキーマ木を推論します。 既定では葉はすべて string として扱い、 range は []struct{} (子フィールドがあれば) または []string (なければ), index は map[string]string を推論します。
Click to show internal directories.
Click to hide internal directories.