Documentation ¶
Index ¶
- func NewDatabase(driver, createAddr, address, underlying, topic string, useAsync bool) (interface{}, error)
- type Database
- func (d *Database) AddRoomTag(ctx context.Context, userId, roomID, tag string, content []byte) error
- func (d *Database) CreateAccount(ctx context.Context, ...) (*authtypes.Account, error)
- func (d *Database) CreateAccountWithCheck(ctx context.Context, oldAccount *authtypes.Account, ...) (*authtypes.Account, error)
- func (d *Database) DeleteRoomTag(ctx context.Context, userId, roomID, tag string) error
- func (d *Database) DeleteUserInfo(ctx context.Context, userID string) error
- func (d *Database) GetAccount(ctx context.Context, userID string) (*authtypes.Account, error)
- func (d *Database) GetAccountDataTotal(ctx context.Context) (int, error)
- func (d *Database) GetAccountsTotal(ctx context.Context) (int, error)
- func (d *Database) GetActualTotal(ctx context.Context) (int, error)
- func (d *Database) GetAllProfile() ([]authtypes.Profile, error)
- func (d *Database) GetAllUserInfo() ([]authtypes.UserInfo, error)
- func (d *Database) GetProfileByUserID(ctx context.Context, userID string) (authtypes.Profile, error)
- func (d *Database) GetRoomTagsTotal(ctx context.Context) (int, error)
- func (d *Database) InsertAccount(ctx context.Context, ...) (*authtypes.Account, error)
- func (d *Database) OnDeleteRoomTag(ctx context.Context, userId, roomID, tag string) error
- func (d *Database) OnDeleteUserInfo(ctx context.Context, userID string) error
- func (d *Database) OnInitProfile(ctx context.Context, userID, displayName, avatarURL string) error
- func (d *Database) OnInitUserInfo(ctx context.Context, ...) error
- func (d *Database) OnInsertAccount(ctx context.Context, userID, hash, appServiceID string, createdTs int64) error
- func (d *Database) OnInsertAccountData(ctx context.Context, userID, roomID, dataType, content string) error
- func (d *Database) OnInsertFilter(ctx context.Context, filter, filterID, userID string) error
- func (d *Database) OnInsertRoomTag(ctx context.Context, userId, roomID, tag string, content []byte) error
- func (d *Database) OnUpsertAvatar(ctx context.Context, userID, avatarURL string) error
- func (d *Database) OnUpsertDisplayName(ctx context.Context, userID, displayName string) error
- func (d *Database) OnUpsertProfile(ctx context.Context, userID, displayName, avatarURL string) error
- func (d *Database) OnUpsertUserInfo(ctx context.Context, ...) error
- func (d *Database) PutFilter(ctx context.Context, userID, filterID, filter string) error
- func (d *Database) RecoverCache()
- func (d *Database) SaveAccountData(ctx context.Context, userID, roomID, dataType, content string) error
- func (d *Database) SetGauge(qryDBGauge mon.LabeledGauge)
- func (d *Database) UpsertAvatar(ctx context.Context, userID, avatarURL string) error
- func (d *Database) UpsertAvatarSync(ctx context.Context, userID, avatarURL string) error
- func (d *Database) UpsertDisplayName(ctx context.Context, userID, displayName string) error
- func (d *Database) UpsertDisplayNameSync(ctx context.Context, userID, displayName string) error
- func (d *Database) UpsertProfile(ctx context.Context, userID, displayName, avatarURL string) error
- func (d *Database) UpsertProfileSync(ctx context.Context, userID, displayName, avatarURL string) error
- func (d *Database) UpsertUserInfo(ctx context.Context, ...) 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 accounts and profiles database conf.Database.Account
Types ¶
type Database ¶
type Database struct { AsyncSave bool // contains filtered or unexported fields }
Database represents an account database
func (*Database) AddRoomTag ¶
func (*Database) CreateAccount ¶
func (d *Database) CreateAccount( ctx context.Context, userID, plaintextPassword, appServiceID, displayName string, ) (*authtypes.Account, error)
CreateAccount makes a new account with the given login name and password, and creates an empty profile for this account. If no password is supplied, the account will be a passwordless account. If the account already exists, it will return nil, nil.
func (*Database) CreateAccountWithCheck ¶
func (*Database) DeleteRoomTag ¶
func (*Database) DeleteUserInfo ¶
func (*Database) GetAccount ¶
func (*Database) GetAccountDataTotal ¶
func (*Database) GetAccountsTotal ¶
func (*Database) GetActualTotal ¶
func (*Database) GetProfileByUserID ¶
func (*Database) GetRoomTagsTotal ¶
func (*Database) InsertAccount ¶
func (*Database) OnDeleteRoomTag ¶
func (*Database) OnDeleteUserInfo ¶
func (*Database) OnInitProfile ¶
func (*Database) OnInitUserInfo ¶
func (*Database) OnInsertAccount ¶
func (*Database) OnInsertAccountData ¶
func (*Database) OnInsertFilter ¶
func (*Database) OnInsertRoomTag ¶
func (*Database) OnUpsertAvatar ¶
func (*Database) OnUpsertDisplayName ¶
func (*Database) OnUpsertProfile ¶
func (*Database) OnUpsertUserInfo ¶
func (*Database) PutFilter ¶
PutFilter puts the passed filter into the database. Returns the filterID as a string. Otherwise returns an error if something goes wrong.
func (*Database) RecoverCache ¶
func (d *Database) RecoverCache()
func (*Database) SaveAccountData ¶
func (d *Database) SaveAccountData( ctx context.Context, userID, roomID, dataType, content string, ) error
SaveAccountData saves new account data for a given user and a given room. If the account data is not specific to a room, the room ID should be an empty string If an account data already exists for a given set (user, room, data type), it will update the corresponding row with the new content Returns a SQL error if there was an issue with the insertion/update
func (*Database) SetGauge ¶
func (d *Database) SetGauge(qryDBGauge mon.LabeledGauge)