PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/app/domain/user_finders.go

http://github.com/sut-go/gon
Go | 20 lines | 16 code | 3 blank | 1 comment | 0 complexity | 617a3886c4ae76667d392ef50b8ce91b MD5 | raw file
 1package user
 2
 3import "gaz"
 4import mymy "github.com/ziutek/mymysql"
 5
 6type UserService struct {
 7    *gaz.Connection
 8    // EntityManager
 9}
10
11func (u *UserService) Get(id string) (result *User) {
12	c := u.DB("test").C("User")
13	result = new(User)
14	data := c.FindOne(gaz.Params{"id":id}).(*mymy.Row)
15	result.Id = data.Int(0)
16	result.Name = data.Str(1)
17	result.Password = data.Str(2)
18	result.Email = data.Str(3)
19	return
20}