mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 23:03:10 -06:00
Add interface method and implement it
Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
This commit is contained in:
parent
5c921476f9
commit
754630a014
|
|
@ -37,4 +37,5 @@ type Database interface {
|
|||
RemoveDevices(ctx context.Context, localpart string, devices []string) error
|
||||
// RemoveAllDevices deleted all devices for this user. Returns the devices deleted.
|
||||
RemoveAllDevices(ctx context.Context, localpart, exceptDeviceID string) (devices []api.Device, err error)
|
||||
UpdateDeviceLastSeen(ctx context.Context, deviceID, ipAddr string) error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,3 +189,10 @@ func (d *Database) RemoveAllDevices(
|
|||
})
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateDeviceLastSeen updates a the last seen timestamp and the ip address
|
||||
func (d *Database) UpdateDeviceLastSeen(ctx context.Context, deviceID, ipAddr string) error {
|
||||
return sqlutil.WithTransaction(d.db, func(txn *sql.Tx) error {
|
||||
return d.devices.updateDeviceLastSeen(ctx, txn, deviceID, ipAddr)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,3 +193,10 @@ func (d *Database) RemoveAllDevices(
|
|||
})
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateDeviceLastSeen updates a the last seen timestamp and the ip address
|
||||
func (d *Database) UpdateDeviceLastSeen(ctx context.Context, deviceID, ipAddr string) error {
|
||||
return sqlutil.WithTransaction(d.db, func(txn *sql.Tx) error {
|
||||
return d.devices.updateDeviceLastSeen(ctx, txn, deviceID, ipAddr)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue