Documentation ¶
Overview ¶
Package database provides definitions and functionality related to the database.
Index ¶
- type Database
- func (d *Database) AdminUserCount() (int64, error)
- func (d *Database) Close()
- func (d *Database) CreateApplication(application *model.Application) error
- func (d *Database) CreateUser(createUser model.CreateUser) (*model.User, error)
- func (d *Database) DeleteApplication(application *model.Application) error
- func (d *Database) DeleteUser(user *model.User) error
- func (d *Database) GetApplicationByID(id uint) (*model.Application, error)
- func (d *Database) GetApplicationByToken(token string) (*model.Application, error)
- func (d *Database) GetApplications(user *model.User) ([]model.Application, error)
- func (d *Database) GetUserByID(id uint) (*model.User, error)
- func (d *Database) GetUserByName(name string) (*model.User, error)
- func (d *Database) GetUsers() ([]model.User, error)
- func (d *Database) Health() error
- func (d *Database) Populate(name, password, matrixID string) error
- func (d *Database) RepairChannels(dp Dispatcher, behavior *configuration.RepairBehavior) error
- func (d *Database) UpdateApplication(application *model.Application) error
- func (d *Database) UpdateUser(user *model.User) error
- type Dispatcher
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 ¶
AdminUserCount returns the number of admins or an error.
func (*Database) CreateApplication ¶
func (d *Database) CreateApplication(application *model.Application) error
CreateApplication creates an application.
func (*Database) CreateUser ¶
CreateUser creates a user.
func (*Database) DeleteApplication ¶
func (d *Database) DeleteApplication(application *model.Application) error
DeleteApplication deletes an application.
func (*Database) DeleteUser ¶
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 ¶
GetApplications returns the applications associated with a given user.
func (*Database) GetUserByID ¶
GetUserByID returns the user with the given ID or nil.
func (*Database) GetUserByName ¶
GetUserByName returns the user with the given name or nil.
func (*Database) Populate ¶
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.
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.