mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 22:22:46 +00:00
Factor out StatementList to sqlutil
and use it in userapi
It helps with the boilerplate.
This commit is contained in:
parent
9e4618000e
commit
ed4097825b
43 changed files with 145 additions and 264 deletions
|
@ -64,22 +64,13 @@ func (s *profilesStatements) prepare(db *sql.DB) (err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
if s.insertProfileStmt, err = db.Prepare(insertProfileSQL); err != nil {
|
||||
return
|
||||
}
|
||||
if s.selectProfileByLocalpartStmt, err = db.Prepare(selectProfileByLocalpartSQL); err != nil {
|
||||
return
|
||||
}
|
||||
if s.setAvatarURLStmt, err = db.Prepare(setAvatarURLSQL); err != nil {
|
||||
return
|
||||
}
|
||||
if s.setDisplayNameStmt, err = db.Prepare(setDisplayNameSQL); err != nil {
|
||||
return
|
||||
}
|
||||
if s.selectProfilesBySearchStmt, err = db.Prepare(selectProfilesBySearchSQL); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
return sqlutil.StatementList{
|
||||
{&s.insertProfileStmt, insertProfileSQL},
|
||||
{&s.selectProfileByLocalpartStmt, selectProfileByLocalpartSQL},
|
||||
{&s.setAvatarURLStmt, setAvatarURLSQL},
|
||||
{&s.setDisplayNameStmt, setDisplayNameSQL},
|
||||
{&s.selectProfilesBySearchStmt, selectProfilesBySearchSQL},
|
||||
}.Prepare(db)
|
||||
}
|
||||
|
||||
func (s *profilesStatements) insertProfile(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue