database

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: ISC Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database holds information for the database connection.

func Create

func Create(cm *credentials.Manager, dialect, connection string) (*Database, error)

Create instanciates a database connection.

func (*Database) AdminUserCount

func (d *Database) AdminUserCount() (int64, error)

AdminUserCount returns the number of admins or an error.

func (*Database) Close

func (d *Database) Close()

Close closes the database connection.

func (*Database) CreateApplication

func (d *Database) CreateApplication(application *model.Application) error

CreateApplication creates an application.

func (*Database) CreateUser

func (d *Database) CreateUser(createUser model.CreateUser) (*model.User, error)

CreateUser creates a user.

func (*Database) DeleteApplication

func (d *Database) DeleteApplication(application *model.Application) error

DeleteApplication deletes an application.

func (*Database) DeleteUser

func (d *Database) DeleteUser(user *model.User) error

DeleteUser deletes a user.

func (*Database) GetApplicationByID

func (d *Database) GetApplicationByID(ID uint) (*model.Application, error)

GetApplicationByID returns the application with the given ID or nil.

func (*Database) GetApplicationByToken

func (d *Database) GetApplicationByToken(token string) (*model.Application, error)

GetApplicationByToken returns the application with the given token or nil.

func (*Database) GetApplications

func (d *Database) GetApplications(user *model.User) ([]model.Application, error)

GetApplications returns the applications associated with a given user.

func (*Database) GetUserByID

func (d *Database) GetUserByID(ID uint) (*model.User, error)

GetUserByID returns the user with the given ID or nil.

func (*Database) GetUserByName

func (d *Database) GetUserByName(name string) (*model.User, error)

GetUserByName returns the user with the given name or nil.

func (*Database) GetUsers

func (d *Database) GetUsers() ([]model.User, error)

GetUsers returns all users.

func (*Database) Health

func (d *Database) Health() error

Health reports the status of the database connection.

func (*Database) Populate

func (d *Database) Populate(name, password, matrixID string) error

Populate fills the database with initial information like the admin user.

func (*Database) RepairChannels

func (d *Database) RepairChannels(dp Dispatcher) error

RepairChannels resets channels that have been modified by a user.

func (*Database) UpdateApplication

func (d *Database) UpdateApplication(application *model.Application) error

UpdateApplication updates an application.

func (*Database) UpdateUser

func (d *Database) UpdateUser(user *model.User) error

UpdateUser updates a user.

type Dispatcher

type Dispatcher interface {
	DeregisterApplication(a *model.Application, u *model.User) error
	UpdateApplication(a *model.Application) error
	IsOrphan(a *model.Application, u *model.User) (bool, error)
	RepairApplication(a *model.Application, u *model.User) error
}

The Dispatcher interface for constructing and destructing channels.

Jump to

Keyboard shortcuts

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