codegen

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(entityPath string, cfg *gen.Config, options ...Extra) error

Generate 在entityPath目录下运行代码生成器。 如果 entity的路径是 `<project>/entity`,则生成的代码将放在 `<project>/entity`目录下。

Params:

  • entityPath: entity package的路径。例如`<project>/entity`。
  • cfg: 代码生成的配置
  • options: 代码生成的选项,用于回调函数

func LoadBuilder

func LoadBuilder(entityPath string, cfg *gen.Config) (*gen.Builder, error)

LoadBuilder 根据提供的路径加载entity package,并生成一个schema。

Params:

  • entityPath: entity package的路径
  • cfg: 代码生成的配置

Returns:

  • 代码构建器
  • 错误信息

Types

type Extra

type Extra func(*gen.Config) error

Extra 用于在Config中添加额外的配置的回调函数。

func TemplateDir

func TemplateDir(path string) Extra

TemplateDir 解析目录类型的模版。

Params:

  • path: 模版目录的路径

Returns:

0: Extra函数。

func TemplateFiles

func TemplateFiles(filenames ...string) Extra

TemplateFiles 解析文件类型的模版

Params:

  • filenames: 模版文件的路径

Returns:

0: Extra函数。

func TemplateGlob

func TemplateGlob(pattern string) Extra

TemplateGlob 解析glob模式下的文件

Params:

  • pattern: glob模式

Returns:

0: Extra函数。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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