mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
Linting
This commit is contained in:
parent
411d4bed4f
commit
d5b59bfb0b
|
|
@ -490,7 +490,7 @@ func (a *UserInternalAPI) uploadBackupKeys(ctx context.Context, req *api.Perform
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if deleted {
|
if deleted {
|
||||||
res.Error = fmt.Sprintf("backup was deleted")
|
res.Error = "backup was deleted"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
res.Exists = true
|
res.Exists = true
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ const insertBackupKeySQL = "" +
|
||||||
|
|
||||||
const updateBackupKeySQL = "" +
|
const updateBackupKeySQL = "" +
|
||||||
"UPDATE account_e2e_room_keys SET first_message_index=$1, forwarded_count=$2, is_verified=$3, session_data=$4 " +
|
"UPDATE account_e2e_room_keys SET first_message_index=$1, forwarded_count=$2, is_verified=$3, session_data=$4 " +
|
||||||
"WHERE user_id=$5 AND room_id=$6 AND session_id=$7"
|
"WHERE user_id=$5 AND room_id=$6 AND session_id=$7 AND version=$8"
|
||||||
|
|
||||||
const countKeysSQL = "" +
|
const countKeysSQL = "" +
|
||||||
"SELECT COUNT(*) FROM account_e2e_room_keys WHERE user_id = $1 AND version = $2"
|
"SELECT COUNT(*) FROM account_e2e_room_keys WHERE user_id = $1 AND version = $2"
|
||||||
|
|
@ -60,6 +60,7 @@ type keyBackupStatements struct {
|
||||||
selectKeysStmt *sql.Stmt
|
selectKeysStmt *sql.Stmt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:unused
|
||||||
func (s *keyBackupStatements) prepare(db *sql.DB) (err error) {
|
func (s *keyBackupStatements) prepare(db *sql.DB) (err error) {
|
||||||
_, err = db.Exec(keyBackupTableSchema)
|
_, err = db.Exec(keyBackupTableSchema)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -100,7 +101,7 @@ func (s *keyBackupStatements) updateBackupKey(
|
||||||
ctx context.Context, txn *sql.Tx, userID, version string, key api.InternalKeyBackupSession,
|
ctx context.Context, txn *sql.Tx, userID, version string, key api.InternalKeyBackupSession,
|
||||||
) (err error) {
|
) (err error) {
|
||||||
_, err = txn.Stmt(s.updateBackupKeyStmt).ExecContext(
|
_, err = txn.Stmt(s.updateBackupKeyStmt).ExecContext(
|
||||||
ctx, key.FirstMessageIndex, key.ForwardedCount, key.IsVerified, string(key.SessionData), userID, key.RoomID, key.SessionID,
|
ctx, key.FirstMessageIndex, key.ForwardedCount, key.IsVerified, string(key.SessionData), userID, key.RoomID, key.SessionID, version,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ type keyBackupVersionStatements struct {
|
||||||
updateKeyBackupETagStmt *sql.Stmt
|
updateKeyBackupETagStmt *sql.Stmt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:unused
|
||||||
func (s *keyBackupVersionStatements) prepare(db *sql.DB) (err error) {
|
func (s *keyBackupVersionStatements) prepare(db *sql.DB) (err error) {
|
||||||
_, err = db.Exec(keyBackupVersionTableSchema)
|
_, err = db.Exec(keyBackupVersionTableSchema)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -418,6 +418,7 @@ func (d *Database) GetKeyBackup(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:nakedret
|
||||||
func (d *Database) UpsertBackupKeys(
|
func (d *Database) UpsertBackupKeys(
|
||||||
ctx context.Context, version, userID string, uploads []api.InternalKeyBackupSession,
|
ctx context.Context, version, userID string, uploads []api.InternalKeyBackupSession,
|
||||||
) (count int64, etag string, err error) {
|
) (count int64, etag string, err error) {
|
||||||
|
|
@ -484,7 +485,6 @@ func (d *Database) UpsertBackupKeys(
|
||||||
} else {
|
} else {
|
||||||
etag = oldETag
|
etag = oldETag
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ const insertBackupKeySQL = "" +
|
||||||
|
|
||||||
const updateBackupKeySQL = "" +
|
const updateBackupKeySQL = "" +
|
||||||
"UPDATE account_e2e_room_keys SET first_message_index=$1, forwarded_count=$2, is_verified=$3, session_data=$4 " +
|
"UPDATE account_e2e_room_keys SET first_message_index=$1, forwarded_count=$2, is_verified=$3, session_data=$4 " +
|
||||||
"WHERE user_id=$5 AND room_id=$6 AND session_id=$7"
|
"WHERE user_id=$5 AND room_id=$6 AND session_id=$7 AND version=$8"
|
||||||
|
|
||||||
const countKeysSQL = "" +
|
const countKeysSQL = "" +
|
||||||
"SELECT COUNT(*) FROM account_e2e_room_keys WHERE user_id = $1 AND version = $2"
|
"SELECT COUNT(*) FROM account_e2e_room_keys WHERE user_id = $1 AND version = $2"
|
||||||
|
|
@ -60,6 +60,7 @@ type keyBackupStatements struct {
|
||||||
selectKeysStmt *sql.Stmt
|
selectKeysStmt *sql.Stmt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:unused
|
||||||
func (s *keyBackupStatements) prepare(db *sql.DB) (err error) {
|
func (s *keyBackupStatements) prepare(db *sql.DB) (err error) {
|
||||||
_, err = db.Exec(keyBackupTableSchema)
|
_, err = db.Exec(keyBackupTableSchema)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -100,7 +101,7 @@ func (s *keyBackupStatements) updateBackupKey(
|
||||||
ctx context.Context, txn *sql.Tx, userID, version string, key api.InternalKeyBackupSession,
|
ctx context.Context, txn *sql.Tx, userID, version string, key api.InternalKeyBackupSession,
|
||||||
) (err error) {
|
) (err error) {
|
||||||
_, err = txn.Stmt(s.updateBackupKeyStmt).ExecContext(
|
_, err = txn.Stmt(s.updateBackupKeyStmt).ExecContext(
|
||||||
ctx, key.FirstMessageIndex, key.ForwardedCount, key.IsVerified, string(key.SessionData), userID, key.RoomID, key.SessionID,
|
ctx, key.FirstMessageIndex, key.ForwardedCount, key.IsVerified, string(key.SessionData), userID, key.RoomID, key.SessionID, version,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ type keyBackupVersionStatements struct {
|
||||||
updateKeyBackupETagStmt *sql.Stmt
|
updateKeyBackupETagStmt *sql.Stmt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:unused
|
||||||
func (s *keyBackupVersionStatements) prepare(db *sql.DB) (err error) {
|
func (s *keyBackupVersionStatements) prepare(db *sql.DB) (err error) {
|
||||||
_, err = db.Exec(keyBackupVersionTableSchema)
|
_, err = db.Exec(keyBackupVersionTableSchema)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -459,6 +459,7 @@ func (d *Database) GetKeyBackup(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:nakedret
|
||||||
func (d *Database) UpsertBackupKeys(
|
func (d *Database) UpsertBackupKeys(
|
||||||
ctx context.Context, version, userID string, uploads []api.InternalKeyBackupSession,
|
ctx context.Context, version, userID string, uploads []api.InternalKeyBackupSession,
|
||||||
) (count int64, etag string, err error) {
|
) (count int64, etag string, err error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue