select fot struct
This commit is contained in:
parent
7a98c5e3d9
commit
266e16a060
11
main.go
11
main.go
|
@ -133,10 +133,17 @@ func Get(username string) (*UserData, bool) {
|
||||||
log.Printf("scsusers.Get: %s", err.Error())
|
log.Printf("scsusers.Get: %s", err.Error())
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
q = fmt.Sprintf("select meta_key, meta_value, id from %s_meta where user=%d", c.TablePrefix, u.UserID)
|
q = fmt.Sprintf("select meta_key, meta_value, id from %s_meta where user=?", c.TablePrefix)
|
||||||
err = c.db.Select(&u.Meta, q)
|
rows,err:=c.db.Query(q,u.UserID )
|
||||||
if err != nil && err != sql.ErrNoRows {
|
if err != nil && err != sql.ErrNoRows {
|
||||||
log.Printf("scsuser.Get: select: %s", err.Error())
|
log.Printf("scsuser.Get: select: %s", err.Error())
|
||||||
|
return u,false
|
||||||
|
}
|
||||||
|
|
||||||
|
for rows.Next() {
|
||||||
|
var m metadata
|
||||||
|
rows.Scan(m.Key,m.Value,m.ID)
|
||||||
|
u.Meta[m.Key]=m
|
||||||
}
|
}
|
||||||
return u, true
|
return u, true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue