accounts

package
v0.0.0-...-9835270 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2021 License: AGPL-3.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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 (d *Database) AddRoomTag(
	ctx context.Context, userId, roomID, tag string, content []byte,
) error

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 (d *Database) CreateAccountWithCheck(
	ctx context.Context, oldAccount *authtypes.Account, userID, plaintextPassword, appServiceID, displayName string,
) (*authtypes.Account, error)

func (*Database) DeleteRoomTag

func (d *Database) DeleteRoomTag(
	ctx context.Context, userId, roomID, tag string,
) error

func (*Database) DeleteUserInfo

func (d *Database) DeleteUserInfo(
	ctx context.Context, userID string,
) error

func (*Database) GetAccount

func (d *Database) GetAccount(ctx context.Context, userID string) (*authtypes.Account, error)

func (*Database) GetAccountDataTotal

func (d *Database) GetAccountDataTotal(
	ctx context.Context,
) (int, error)

func (*Database) GetAccountsTotal

func (d *Database) GetAccountsTotal(
	ctx context.Context,
) (int, error)

func (*Database) GetActualTotal

func (d *Database) GetActualTotal(
	ctx context.Context,
) (int, error)

func (*Database) GetAllProfile

func (d *Database) GetAllProfile() ([]authtypes.Profile, error)

func (*Database) GetAllUserInfo

func (d *Database) GetAllUserInfo() ([]authtypes.UserInfo, error)

func (*Database) GetProfileByUserID

func (d *Database) GetProfileByUserID(ctx context.Context, userID string) (authtypes.Profile, error)

func (*Database) GetRoomTagsTotal

func (d *Database) GetRoomTagsTotal(
	ctx context.Context,
) (int, error)

func (*Database) InsertAccount

func (d *Database) InsertAccount(
	ctx context.Context, userID, plaintextPassword, appServiceID, displayName string,
) (*authtypes.Account, error)

func (*Database) OnDeleteRoomTag

func (d *Database) OnDeleteRoomTag(
	ctx context.Context, userId, roomID, tag string,
) error

func (*Database) OnDeleteUserInfo

func (d *Database) OnDeleteUserInfo(
	ctx context.Context, userID string,
) error

func (*Database) OnInitProfile

func (d *Database) OnInitProfile(
	ctx context.Context, userID, displayName, avatarURL string,
) error

func (*Database) OnInitUserInfo

func (d *Database) OnInitUserInfo(
	ctx context.Context, userID, userName, jobNumber, mobile, landline, email string, state int,
) error

func (*Database) OnInsertAccount

func (d *Database) OnInsertAccount(
	ctx context.Context, userID, hash, appServiceID string, createdTs int64,
) error

func (*Database) OnInsertAccountData

func (d *Database) OnInsertAccountData(
	ctx context.Context, userID, roomID, dataType, content string,
) error

func (*Database) OnInsertFilter

func (d *Database) OnInsertFilter(
	ctx context.Context, filter, filterID, userID string,
) error

func (*Database) OnInsertRoomTag

func (d *Database) OnInsertRoomTag(
	ctx context.Context, userId, roomID, tag string, content []byte,
) error

func (*Database) OnUpsertAvatar

func (d *Database) OnUpsertAvatar(
	ctx context.Context, userID, avatarURL string,
) error

func (*Database) OnUpsertDisplayName

func (d *Database) OnUpsertDisplayName(
	ctx context.Context, userID, displayName string,
) error

func (*Database) OnUpsertProfile

func (d *Database) OnUpsertProfile(
	ctx context.Context, userID, displayName, avatarURL string,
) error

func (*Database) OnUpsertUserInfo

func (d *Database) OnUpsertUserInfo(
	ctx context.Context, userID, userName, jobNumber, mobile, landline, email string, state int,
) error

func (*Database) PutFilter

func (d *Database) PutFilter(
	ctx context.Context, userID, filterID, filter string,
) error

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)

func (*Database) UpsertAvatar

func (d *Database) UpsertAvatar(ctx context.Context, userID, avatarURL string,
) error

func (*Database) UpsertAvatarSync

func (d *Database) UpsertAvatarSync(ctx context.Context, userID, avatarURL string,
) error

func (*Database) UpsertDisplayName

func (d *Database) UpsertDisplayName(ctx context.Context, userID, displayName string,
) error

func (*Database) UpsertDisplayNameSync

func (d *Database) UpsertDisplayNameSync(ctx context.Context, userID, displayName string,
) error

func (*Database) UpsertProfile

func (d *Database) UpsertProfile(ctx context.Context, userID, displayName, avatarURL string,
) error

func (*Database) UpsertProfileSync

func (d *Database) UpsertProfileSync(ctx context.Context, userID, displayName, avatarURL string,
) error

func (*Database) UpsertUserInfo

func (d *Database) UpsertUserInfo(
	ctx context.Context, userID, userName, jobNumber, mobile, landline, email string, state int,
) error

func (*Database) WriteDBEvent

func (d *Database) WriteDBEvent(ctx context.Context, update *dbtypes.DBEvent) error

func (*Database) WriteDBEventWithTbl

func (d *Database) WriteDBEventWithTbl(ctx context.Context, update *dbtypes.DBEvent, tbl string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL