gen

package
v0.0.0-...-58acc5f Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gen はテンプレートからGoコードを生成します。

このパッケージは以下の処理を順次実行します:

  1. テンプレートのスキャン (internal/scan)
  2. 型の解決 (internal/typing)
  3. Goコードの生成

生成されるコードには、Params構造体、Template関数、Render関数が含まれます。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmitResult

type EmitResult struct {
	MainCode    string   // 型定義とRender関数
	SourcesCode string   // テンプレート文字列リテラル
	Warnings    []string // 警告メッセージ
}

EmitResult はコード生成の結果を保持する

func Emit

func Emit(specs []TemplateSpec) (*EmitResult, error)

Emit は複数のテンプレートから2つの統合Goファイルを生成する 単一テンプレートの場合も同じフォーマットで生成される

type TemplateSpec

type TemplateSpec struct {
	Name     string // テンプレート名 (例: "footer", "mail_invite/title")
	Pkg      string // 出力パッケージ名
	FilePath string // テンプレートファイルパス(情報として保持)
	Source   string // テンプレート本文
}

TemplateSpec は単一のテンプレート仕様

Jump to

Keyboard shortcuts

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