gen

package
v1.3.28 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenGrpc   = "grpc"
	GenDB     = "database"
	GenDoc    = "doc"
	GenRouter = "router"
	GenEnum   = "enum"
	GenConfig = "config"
)
View Source
const (
	ConfigFileName        = "config_origin.yaml"
	ConfigEncryptFileName = "config.yaml"
)

Variables

This section is empty.

Functions

func CarGen

func CarGen(name, dbName, grpcPath, grpcPkgName, distPath, distPkg string)

func ConfigGen added in v1.3.2

func ConfigGen(genPath string, configFileName string, configEncryptFileName string)

func CreateApiRouter

func CreateApiRouter(genPath string)

CreateApiRouter 生成api路由

func GormGen

func GormGen(path, dsn, name string, tables []string)

func KitexGen

func KitexGen(name, path string)

func ModApiGen added in v1.3.2

func ModApiGen()

func ModServerGen added in v1.3.2

func ModServerGen()

func ModelToProtobuf

func ModelToProtobuf(path, protoPkg, goPkg, modelPath, modelName string)

Types

type Config

type Config struct {
	Gen       string //生成类型
	Path      string //基础项目路径
	Name      string //服务名
	Des       string //描述
	Version   string //版本
	DbDsn     string //数据库Dsn
	Tables    string //数据表 ,隔开
	DbName    string //库别名 避免名称过长或者库名差异
	DictTable string //字典表名
	DictType  string //字典类型字段名
	DictName  string //字典名称字段名
	DictLabel string //字典标签字段名
	DictValue string //字典值字段名
	Out       string //输出目录
}

func (Config) Build

func (c Config) Build()

type FileInfo

type FileInfo struct {
	Name   string
	Buffer bytes.Buffer
}

type Generator

type Generator struct {
	Model    string
	PkgPath  string
	PkgName  string
	DistPath string
	DistPkg  string
	DbName   string

	ServiceFields []ServiceField
	MethodImports []string
	ServiceFiles  []ServiceFileInfo
	// contains filtered or unexported fields
}

func (*Generator) Run

func (g *Generator) Run() error

type ServiceField

type ServiceField struct {
	Import string
	Field  string
}

type ServiceFileInfo

type ServiceFileInfo struct {
	FileInfo
}

ServiceFileInfo 文件内容

type TableInfo added in v1.1.6

type TableInfo struct {
	Generated       bool   // whether to generate db model
	FileName        string // generated file name
	S               string // the first letter(lower case)of simple Name (receiver)
	QueryStructName string // internal query struct name
	ModelStructName string // origin/model struct name
	TableName       string // table name in db server
}

Jump to

Keyboard shortcuts

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