codegen

command module
v0.0.0-...-0473a72 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 4 Imported by: 0

README

example

package internal


//go:generate go run ../main.go -path=./ -modelName=Dept
type (
	Dept struct {
		DeptId int `db:"dept_id"`
		DeptName string `db:"dept_name"`
		Phone string `db:"phone"`

	}
)



func (u *Dept) ID() int {
	return u.DeptId
}
func (u *Dept) SetLastInsertId(id int64) {
	u.DeptId = int(id)
}

func (U *Dept) IdName() string {
	return "dept_id"
}
func (u *Dept) TableName() string {
	return "dept"
}

通过调用 go generate 生成一些简单的代码

使用方法

go get gitee.com/lyrlyrlyr/codegen.git
codegen -path=./ -modelName=User

package internal

//go:generate go run ../main.go -pkgPath=./  -pkgName=internal -fileName=depth.go  -modelName=Dept
type (
	// Dept
	//  @tableName: dept
	//  @tableId: dept_id
	Dept struct {
		DeptId   int    `db:"dept_id" form:"deptId" json:"deptId"`
		DeptName string `db:"dept_name" form:"deptName" json:"deptName"`
		Phone    string `db:"phone" form:"phone" json:"phone"`
	}
)


Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
util

Jump to

Keyboard shortcuts

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