aboutsummaryrefslogtreecommitdiff
path: root/userapi/storage/accounts/postgres/openid_table.go
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2021-07-28 18:30:04 +0100
committerKegan Dougal <kegan@matrix.org>2021-07-28 18:30:04 +0100
commited4097825bc65f2332bcdc975ed201841221ff7c (patch)
tree4ac6270fa282b1d13ac73c97e4078f1961dbdf4e /userapi/storage/accounts/postgres/openid_table.go
parent9e4618000e0347741eac1279bf6c94c3b9980785 (diff)
Factor out StatementList to `sqlutil` and use it in `userapi`
It helps with the boilerplate.
Diffstat (limited to 'userapi/storage/accounts/postgres/openid_table.go')
-rw-r--r--userapi/storage/accounts/postgres/openid_table.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/userapi/storage/accounts/postgres/openid_table.go b/userapi/storage/accounts/postgres/openid_table.go
index 86c19705..190d141b 100644
--- a/userapi/storage/accounts/postgres/openid_table.go
+++ b/userapi/storage/accounts/postgres/openid_table.go
@@ -39,14 +39,11 @@ func (s *tokenStatements) prepare(db *sql.DB, server gomatrixserverlib.ServerNam
if err != nil {
return
}
- if s.insertTokenStmt, err = db.Prepare(insertTokenSQL); err != nil {
- return
- }
- if s.selectTokenStmt, err = db.Prepare(selectTokenSQL); err != nil {
- return
- }
s.serverName = server
- return
+ return sqlutil.StatementList{
+ {&s.insertTokenStmt, insertTokenSQL},
+ {&s.selectTokenStmt, selectTokenSQL},
+ }.Prepare(db)
}
// insertToken inserts a new OpenID Connect token to the DB.