Documentation ¶
Index ¶
- func NewDatabase(driver, createAddr, address, underlying, topic string, useAsync bool) (interface{}, error)
- type Database
- func (d *Database) CheckDevice(ctx context.Context, identifier, userID string) (string, string, int64, error)
- func (d *Database) CreateDevice(ctx context.Context, userID, deviceID, deviceType string, displayName *string, ...) (dev *authtypes.Device, returnErr error)
- func (d *Database) CreateMigDevice(ctx context.Context, userID, deviceID, token, migToken string) error
- func (d *Database) GetDeviceTotal(ctx context.Context) (int, error)
- func (d *Database) InsertDevice(ctx context.Context, userID string, deviceID *string, displayName *string, ...) error
- func (d *Database) LoadFilterData(ctx context.Context, key string, f *filter.Filter) bool
- func (d *Database) LoadSimpleFilterData(ctx context.Context, f *filter.SimpleFilter) bool
- func (d *Database) OnDeleteDevice(ctx context.Context, deviceID, userID string, createTs int64) error
- func (d *Database) OnInsertDevice(ctx context.Context, userID string, deviceID *string, displayName *string, ...) error
- func (d *Database) OnInsertMigDevice(ctx context.Context, access_token, mig_access_token, deviceID, userID string) error
- func (d *Database) OnUpdateDeviceActiveTs(ctx context.Context, deviceID, userID string, lastActiveTs int64) error
- func (d *Database) RecoverCache()
- func (d *Database) RemoveAllUserMigDevices(ctx context.Context, userID string) error
- func (d *Database) RemoveDevice(ctx context.Context, deviceID, userID string, createTs int64) error
- func (d *Database) RemoveMigDevice(ctx context.Context, deviceID, userID string) error
- func (d *Database) SelectUnActiveDevice(ctx context.Context, lastActiveTs int64, limit, offset int) ([]string, []string, []string, int, error)
- func (d *Database) SetGauge(qryDBGauge mon.LabeledGauge)
- func (d *Database) UpdateDeviceActiveTs(ctx context.Context, deviceID, userID string, lastActiveTs int64) error
- func (d *Database) WriteDBEvent(ctx context.Context, update *dbtypes.DBEvent) error
- func (d *Database) WriteDBEventWithTbl(ctx context.Context, update *dbtypes.DBEvent, tbl string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatabase ¶
func NewDatabase(driver, createAddr, address, underlying, topic string, useAsync bool) (interface{}, error)
NewDatabase creates a new device database
Types ¶
type Database ¶
type Database struct { AsyncSave bool // contains filtered or unexported fields }
Database represents a device database.
func (*Database) CheckDevice ¶
func (*Database) CreateDevice ¶
func (d *Database) CreateDevice( ctx context.Context, userID, deviceID, deviceType string, displayName *string, isHuman bool, identifier *string, specifiedTime int64, ) (dev *authtypes.Device, returnErr error)
CreateDevice makes a new device associated with the given user ID. If there is already a device with the same device ID for this user, that access token will be revoked and replaced with the given accessToken. If the given accessToken is already in use for another device, an error will be returned. If no device ID is given one is generated. Returns the device on success.
func (*Database) CreateMigDevice ¶
func (*Database) GetDeviceTotal ¶
func (*Database) InsertDevice ¶
func (*Database) LoadFilterData ¶
func (*Database) LoadSimpleFilterData ¶
func (*Database) OnDeleteDevice ¶
func (*Database) OnInsertDevice ¶
func (*Database) OnInsertMigDevice ¶
func (*Database) OnUpdateDeviceActiveTs ¶
func (*Database) RecoverCache ¶
func (d *Database) RecoverCache()
func (*Database) RemoveAllUserMigDevices ¶
func (*Database) RemoveDevice ¶
func (d *Database) RemoveDevice( ctx context.Context, deviceID, userID string, createTs int64, ) error
RemoveDevice revokes a device by deleting the entry in the database matching with the given device ID and user ID If the device doesn't exist, it will not return an error If something went wrong during the deletion, it will return the SQL error
func (*Database) RemoveMigDevice ¶
func (*Database) SelectUnActiveDevice ¶
func (*Database) SetGauge ¶
func (d *Database) SetGauge(qryDBGauge mon.LabeledGauge)
func (*Database) UpdateDeviceActiveTs ¶
func (*Database) WriteDBEvent ¶
WriteOutputEvents implements OutputRoomEventWriter