gen

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenGrpc   = "grpc"
	GenDB     = "database"
	GenDoc    = "doc"
	GenRouter = "router"
)

Variables

This section is empty.

Functions

func CarGen

func CarGen(name, dbName, grpcPath, grpcPkgName, distPath, distPkg 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 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 //库别名 避免名称过长或者库名差异
	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