Documentation ¶
Overview ¶
Package store provides an interface for all database operations
Index ¶
- Variables
- func DSN(options config.StoreOptions) string
- type Settings
- type Store
- func (s *Store) CreateInvite(invite *models.Invite) error
- func (s *Store) CreateRoom(room *models.Room) error
- func (s *Store) CreateServer(server *models.Server) error
- func (s *Store) CreateUser(user models.PublicUser) error
- func (s *Store) DeleteRoom(roomHash string) error
- func (s *Store) DeleteServer(serverHash string) error
- func (s *Store) GetRoom(roomHash string) (*models.Room, error)
- func (s *Store) GetRooms() ([]models.Room, error)
- func (s *Store) GetServer(serverHash string) (*models.Server, error)
- func (s *Store) GetServers() ([]models.Server, error)
- func (s *Store) GetSettings() (*Settings, error)
- func (s *Store) GetUser(username string) (models.User, error)
- func (s *Store) GetUserPublicKey(username string) (string, error)
- func (s *Store) GetUserServers(username string) error
- func (s *Store) Migrate() error
- func (s *Store) UpdateRoom(roomHash string, new *models.Room) error
- func (s *Store) UpdateServer(serverHash string, new *models.Server) error
- func (s *Store) UpdateTwoFAVerify(username, verify string) error
- func (s *Store) UpdateUser(username string, user *models.User) error
Constants ¶
This section is empty.
Variables ¶
var DefaultSettings = &Settings{ IsInstalled: false, SuperadminExists: false, }
DefaultSettings provide the default values for settings
var ( // ErrInvalidDatabaseType indicates the provided database type is not supported ErrInvalidDatabaseType = errors.New("Invalid database type") )
Functions ¶
func DSN ¶
func DSN(options config.StoreOptions) string
DSN returns a data source name for a database connection, refer https://github.com/go-sql-driver/mysql#dsn-data-source-name
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps a sqlx database connection
func New ¶
func New(t string, options config.StoreOptions) (*Store, error)
New returns a new store instance
func (*Store) CreateInvite ¶
CreateInvite creates a new invite
func (*Store) CreateRoom ¶
CreateRoom inserts a new room entry into the database
func (*Store) CreateServer ¶
CreateServer inserts a new server entry into the database
func (*Store) CreateUser ¶
func (s *Store) CreateUser(user models.PublicUser) error
func (*Store) DeleteRoom ¶
DeleteRoom deletes ONE room entry with provided 'roomHash' from the database
func (*Store) DeleteServer ¶
DeleteServer deletes ONE server entry with provided 'serverHash' from the database
func (*Store) GetServer ¶
GetServer selects ONE server entry with provided 'serverHash' from the database
func (*Store) GetServers ¶
GetServers selects multiple server entries from the database
func (*Store) GetSettings ¶
GetSettings returns the settings or creates a new default entry in the database
func (*Store) GetUserServers ¶
func (*Store) UpdateRoom ¶
UpdateRoom updates ONE room entry with provided 'roomHash' in the database
func (*Store) UpdateServer ¶
UpdateServer updates ONE server entry with provided 'serverHash' in the database