database

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: ISC Imports: 14 Imported by: 0

Documentation

Overview

Package database provides definitions and functionality related to the database.

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, behavior *configuration.RepairBehavior) 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, behavior *configuration.RepairBehavior) 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