Documentation
¶
Index ¶
- func ShowSchemaChinese(sch *schema.Schema)
- func ShowSchemaEnglish(sch *schema.Schema)
- type CodeGenerationConfig
- type ColumnsMethodStructOutput
- type Config
- type Configs
- type Options
- func (o *Options) WithColumnClassExportable(columnClassExportable bool) *Options
- func (o *Options) WithColumnsCheckFieldType(columnsCheckFieldType bool) *Options
- func (o *Options) WithColumnsMethodRecvName(columnsMethodRecvName string) *Options
- func (o *Options) WithEmbedColumnOperations(embedColumnOperations bool) *Options
- func (o *Options) WithExcludeUntaggedFields(excludeUntaggedFields bool) *Options
- func (o *Options) WithMatchIgnoreExportable(matchIgnoreExportable bool) *Options
- func (o *Options) WithTagKeyName(tagKeyName string) *Options
- func (o *Options) WithUseTagName(useTagName bool) *Options
- type SchemaConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShowSchemaChinese ¶
ShowSchemaChinese Displays schema information including struct name, table name, and fields. ShowSchemaChinese 显示模式结构信息,包括结构体名称、表名和字段信息。
func ShowSchemaEnglish ¶
ShowSchemaEnglish Displays schema information including struct name, table name, and fields. ShowSchemaEnglish 显示模式结构信息,包括结构体名称、表名和字段信息。
Types ¶
type CodeGenerationConfig ¶
type CodeGenerationConfig struct {
// contains filtered or unexported fields
}
CodeGenerationConfig defines the configuration of code generation. CodeGenerationConfig 是代码生成的配置
func NewCodeGenerationConfig ¶
func NewCodeGenerationConfig(schemas []*SchemaConfig) *CodeGenerationConfig
NewCodeGenerationConfig creates a new instance of CodeGenerationConfig. NewCodeGenerationConfig 创建一个新的 CodeGenerationConfig 实例
type ColumnsMethodStructOutput ¶
type ColumnsMethodStructOutput struct {
// contains filtered or unexported fields
}
ColumnsMethodStructOutput Structure representing the generated method and struct code with package imports. ColumnsMethodStructOutput 表示生成的方法和结构体代码,以及涉及的包导入信息。
func (*ColumnsMethodStructOutput) GetMethodCode ¶
func (x *ColumnsMethodStructOutput) GetMethodCode() string
func (*ColumnsMethodStructOutput) GetPkgImports ¶
func (x *ColumnsMethodStructOutput) GetPkgImports() map[string]bool
func (*ColumnsMethodStructOutput) GetStructCode ¶
func (x *ColumnsMethodStructOutput) GetStructCode() string
type Config ¶
type Config = SchemaConfig
Config Configuration of generating column methods and structures. Config 根据模型生成列方法和结构的配置。
func NewConfig ¶
NewConfig Creates a new Config instance with the provided schema, struct name, method name, and options. NewConfig 创建一个新的 Config 实例,使用提供的 schema、结构体名称、方法名称和选项。
func (*Config) Gen ¶
func (c *Config) Gen() *ColumnsMethodStructOutput
Gen Generates the column method and struct based on the configuration. Gen 根据配置生成列方法和结构。
func (*Config) Generate ¶
func (c *Config) Generate() *ColumnsMethodStructOutput
Generate Generates the column method and struct based on the configuration. Generate 根据配置生成列方法和结构。
type Configs ¶
type Configs = CodeGenerationConfig
Configs is an alias for CodeGenerationConfig, used for code generation tasks. Configs 是 CodeGenerationConfig 的别名,用于代码生成任务
func NewConfigs ¶
NewConfigs initializes a Configs instance based on provided models and options. NewConfigs 根据提供的模型和选项初始化 Configs 实例
func (*Configs) Gen ¶
func (cfg *Configs) Gen()
Gen is the core method responsible for generating code based on the provided schemas. Gen 是核心方法,负责根据提供的 schemas 生成代码
func (*Configs) Generate ¶
func (cfg *Configs) Generate()
Generate triggers the code generation process by calling the Gen method. Generate 通过调用 Gen 方法触发代码生成过程
func (*Configs) WithMethodOutputPath ¶
WithMethodOutputPath specifies the output path for method code. WithMethodOutputPath 设置方法代码的输出路径
func (*Configs) WithStructOutputPath ¶
WithStructOutputPath specifies the output path for struct code. WithStructOutputPath 设置结构体代码的输出路径
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options Configuration options for controlling the generation behavior. Options 用于控制生成行为的配置选项。
func NewOptions ¶
func NewOptions() *Options
NewOptions creates a new Options instance with default values. NewOptions 用于创建一个具有默认值的 Options 实例。
func (*Options) WithColumnClassExportable ¶
func (*Options) WithColumnsCheckFieldType ¶
func (*Options) WithColumnsMethodRecvName ¶
func (*Options) WithEmbedColumnOperations ¶
func (*Options) WithExcludeUntaggedFields ¶
func (*Options) WithMatchIgnoreExportable ¶
func (*Options) WithTagKeyName ¶
func (*Options) WithUseTagName ¶
type SchemaConfig ¶
type SchemaConfig struct {
// contains filtered or unexported fields
}
SchemaConfig Configuration of generating column methods and structures. SchemaConfig 根据模型生成列方法和结构的配置。
func NewSchemaConfig ¶
func NewSchemaConfig(object interface{}, options *Options) *SchemaConfig
NewSchemaConfig Creates a Config instance for the given destination model and options. NewSchemaConfig 为指定的目标模型和选项创建 Config 实例。