MCPcopy Index your code
hub / github.com/TruthHun/DocHub / GetById

Method GetById

models/UserModel.go:160–176  ·  view source on GitHub ↗

获取除了用户密码之外的用户全部信息 @param id 用户id @return params 用户信息 @return rows 记录数 @return err 错误

(id interface{})

Source from the content-addressed store, hash-verified

158//@return rows 记录数
159//@return err 错误
160func (this *User) GetById(id interface{}) (params orm.Params, rows int64, err error) {
161 var data []orm.Params
162 tables := []string{GetTableUser() + " u", GetTableUserInfo() + " ui"}
163 on := []map[string]string{
164 {"u.Id": "ui.Id"},
165 }
166 fields := map[string][]string{
167 "u": GetFields(NewUser()),
168 "ui": GetFields(NewUserInfo()),
169 }
170 if sql, err := LeftJoinSqlBuild(tables, on, fields, 1, 1, nil, nil, "u.Id=?"); err == nil {
171 if rows, err = orm.NewOrm().Raw(sql, id).Values(&data); err == nil && len(data) > 0 {
172 params = data[0]
173 }
174 }
175 return
176}
177
178var (
179 errFailedToDown = errors.New("文档下载失败")

Callers 6

GetMethod · 0.45
CoinMethod · 0.45
CollectMethod · 0.45
DocEditMethod · 0.45
GetMethod · 0.45
PrepareMethod · 0.45

Calls 6

GetTableUserFunction · 0.85
GetTableUserInfoFunction · 0.85
GetFieldsFunction · 0.85
NewUserFunction · 0.85
NewUserInfoFunction · 0.85
LeftJoinSqlBuildFunction · 0.85

Tested by

no test coverage detected