Skip to content

lastsweetop/gobatis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gobatis

Golang version of mybatis.

Generate dao code from tag of structure.

So you don't have to worry about the performance issues caused by orm reflection, but you can still get rid of the boring dao layer code

install

go install github.com/lastsweetop/gobatis

generate

`//go:generate gobatis

tag

type User struct {
	GetAll     func() []model.User                `gobatis:"select id,account,nickName from user"`
	GetUser    func(*model.UserParam) *model.User `gobatis:"select id,account,nickName from user where id=?"`
	DeleteUser func(*model.UserParam) error       `gobatis:"delete from user where id=?"`
	AddUser    func(param *model.UserParam) error `gobatis:"insert user (account,nickName) values (?,?)"`
	UpdateUser func(param *model.UserParam) error `gobatis:"update user set account=?,nickName=? where id=?"`
}

type Device struct {
}

About

Golang version of mybatis.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages