Rename RemoveSession to DeleteSession in threepids database

This commit is contained in:
Piotr Kozimor 2021-08-10 10:39:06 +02:00
parent e81c9c17b7
commit 503f43abe0
2 changed files with 3 additions and 3 deletions

View file

@ -15,7 +15,7 @@ type Database interface {
GetSession(ctx context.Context, sid string) (*api.Session, error) GetSession(ctx context.Context, sid string) (*api.Session, error)
GetSessionByThreePidAndSecret(ctx context.Context, threePid, ClientSecret string) (*api.Session, error) GetSessionByThreePidAndSecret(ctx context.Context, threePid, ClientSecret string) (*api.Session, error)
UpdateSendAttemptNextLink(ctx context.Context, sid, nextLink string) error UpdateSendAttemptNextLink(ctx context.Context, sid, nextLink string) error
RemoveSession(ctx context.Context, sid string) error DeleteSession(ctx context.Context, sid string) error
ValidateSession(ctx context.Context, sid string, validatedAt int) error ValidateSession(ctx context.Context, sid string, validatedAt int) error
} }
@ -59,7 +59,7 @@ func (d *Db) UpdateSendAttemptNextLink(ctx context.Context, sid, nextLink string
return d.writeHandler(h) return d.writeHandler(h)
} }
func (d *Db) RemoveSession(ctx context.Context, sid string) error { func (d *Db) DeleteSession(ctx context.Context, sid string) error {
h := func(_ *sql.Tx) error { h := func(_ *sql.Tx) error {
_, err := d.stm.deleteSessionStmt.ExecContext(ctx, sid) _, err := d.stm.deleteSessionStmt.ExecContext(ctx, sid)
return err return err

View file

@ -69,7 +69,7 @@ func TestBumpSendAttempt(t *testing.T) {
func TestDeleteSession(t *testing.T) { func TestDeleteSession(t *testing.T) {
is := is.New(t) is := is.New(t)
dut := mustNewDatabaseWithTestSession(is) dut := mustNewDatabaseWithTestSession(is)
err := dut.RemoveSession(testCtx, testSession.Sid) err := dut.DeleteSession(testCtx, testSession.Sid)
is.NoErr(err) is.NoErr(err)
_, err = dut.GetSession(testCtx, testSession.Sid) _, err = dut.GetSession(testCtx, testSession.Sid)
is.Equal(err, sql.ErrNoRows) is.Equal(err, sql.ErrNoRows)