Fix some linting errors

This commit is contained in:
Kegan Dougal 2020-02-13 14:03:50 +00:00
parent 28c2249b25
commit 232ea948ab
5 changed files with 6 additions and 16 deletions

View file

@ -84,7 +84,7 @@ func (s *inviteStatements) insertInviteEvent(
inviteEventJSON []byte, inviteEventJSON []byte,
) (bool, error) { ) (bool, error) {
stmt := common.TxStmt(txn, s.insertInviteEventStmt) stmt := common.TxStmt(txn, s.insertInviteEventStmt)
defer stmt.Close() defer stmt.Close() // nolint: errcheck
result, err := stmt.ExecContext( result, err := stmt.ExecContext(
ctx, inviteEventID, roomNID, targetUserNID, senderUserNID, inviteEventJSON, ctx, inviteEventID, roomNID, targetUserNID, senderUserNID, inviteEventJSON,
) )

View file

@ -16,7 +16,3 @@ func sqliteIn(a pq.Int64Array) string {
} }
return strings.Join(b, ",") return strings.Join(b, ",")
} }
func sqliteInStr(a pq.StringArray) string {
return "\"" + strings.Join(a, "\",\"") + "\""
}

View file

@ -181,7 +181,7 @@ func (s *stateBlockStatements) bulkSelectStateBlockEntries(
} }
func (s *stateBlockStatements) bulkSelectFilteredStateBlockEntries( func (s *stateBlockStatements) bulkSelectFilteredStateBlockEntries(
ctx context.Context, txn *sql.Tx, ctx context.Context, txn *sql.Tx, // nolint: unparam
stateBlockNIDs []types.StateBlockNID, stateBlockNIDs []types.StateBlockNID,
stateKeyTuples []types.StateKeyTuple, stateKeyTuples []types.StateKeyTuple,
) ([]types.StateEntryList, error) { ) ([]types.StateEntryList, error) {
@ -259,14 +259,6 @@ func (s *stateBlockStatements) bulkSelectFilteredStateBlockEntries(
return results, nil return results, nil
} }
func stateBlockNIDsAsArray(stateBlockNIDs []types.StateBlockNID) pq.Int64Array {
nids := make([]int64, len(stateBlockNIDs))
for i := range stateBlockNIDs {
nids[i] = int64(stateBlockNIDs[i])
}
return pq.Int64Array(nids)
}
type stateKeyTupleSorter []types.StateKeyTuple type stateKeyTupleSorter []types.StateKeyTuple
func (s stateKeyTupleSorter) Len() int { return len(s) } func (s stateKeyTupleSorter) Len() int { return len(s) }

View file

@ -48,7 +48,6 @@ const bulkSelectStateBlockNIDsSQL = "" +
type stateSnapshotStatements struct { type stateSnapshotStatements struct {
db *sql.DB db *sql.DB
insertStateStmt *sql.Stmt insertStateStmt *sql.Stmt
insertStateResultStmt *sql.Stmt
bulkSelectStateBlockNIDsStmt *sql.Stmt bulkSelectStateBlockNIDsStmt *sql.Stmt
} }

View file

@ -401,7 +401,10 @@ func (d *Database) GetLatestEventsForUpdate(
// 'database is locked' errors caused by multiple write txns (one being the long-lived txn created here) // 'database is locked' errors caused by multiple write txns (one being the long-lived txn created here)
// so for now let's not use a long-lived txn at all, and just commit it here and set the txn to nil so // so for now let's not use a long-lived txn at all, and just commit it here and set the txn to nil so
// we fail fast if someone tries to use the underlying txn object. // we fail fast if someone tries to use the underlying txn object.
txn.Commit() err = txn.Commit()
if err != nil {
return nil, err
}
return &roomRecentEventsUpdater{ return &roomRecentEventsUpdater{
transaction{ctx, nil}, d, roomNID, stateAndRefs, lastEventIDSent, currentStateSnapshotNID, transaction{ctx, nil}, d, roomNID, stateAndRefs, lastEventIDSent, currentStateSnapshotNID,
}, nil }, nil