dial

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DbType_ = e.NewEnum(_DbType{
	MYSQL:     dbType{driverName: "mysql"},
	ORACLE:    dbType{driverName: "oracle"},
	POSTGRES:  dbType{driverName: "postgres"},
	SQLSERVER: dbType{driverName: "mssql"},
	SQLITE:    dbType{driverName: "sqlite"},
})

Functions

This section is empty.

Types

type Columns

type Columns []string

type GenCfg

type GenCfg struct {
	// 数据库类型,必填
	DbType dbType
	// 数据库连接URL,空字符串时不会生成实体,必填
	Dsn string
	// 相对生成器运行目录的go.mod文件路径,必填
	GoModPath string
	// 生成文件路径配置
	PathCfg PathCfg
	// 名称映射配置
	NameMapperCfg NameMapperCfg
	// 表配置
	TableCfg TableCfg
	// 逻辑删除配置
	LogicalDelCfg LogicalDelCfg
}

GenCfg 生成配置

type Generator

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

func GetGenerator

func GetGenerator(cfg GenCfg) *Generator

GetGenerator 创建生成器

func (*Generator) Gen

func (g *Generator) Gen()

type Ignores

type Ignores map[string]Columns

type LogicalDelCfg

type LogicalDelCfg struct {
	// 逻辑删除字段
	Column string
	// ID字段,删除时将逻辑删除字段设置为该字段值,若为空则逻辑删除字段设置为NULL
	IdColumn string
	// 查询数据时逻辑删除字段的条件值,只能为string和int类型
	QueryValue any
}

type NameMapperCfg

type NameMapperCfg struct {
	// 表名->实体 名称映射,默认转大驼峰
	Entity *orm.NameMapper
	// 表名->DAO 名称映射,默认转大驼峰
	Dao *orm.NameMapper
}

type PathCfg

type PathCfg struct {
	// 生成文件路径,相对go.mod文件,默认为“dao”
	OutPath string
	// 实体文件路径,相对于OutPath,默认为"entity"
	EntityPath string
}

type TableCfg

type TableCfg struct {
	// 需要生成的表
	Tables Tables
	// 指定表忽略的字段,key为表名,value为列名
	Ignores Ignores
}

type Tables

type Tables []string

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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