Documentation ¶
Index ¶
- type GormDatabase
- func (d *GormDatabase) Close()
- func (d *GormDatabase) CreateApplication(application *model.Application) error
- func (d *GormDatabase) CreateClient(client *model.Client) error
- func (d *GormDatabase) CreateMessage(message *model.Message) error
- func (d *GormDatabase) CreateUser(user *model.User) error
- func (d *GormDatabase) DeleteApplicationByID(id uint) error
- func (d *GormDatabase) DeleteClientByID(id uint) error
- func (d *GormDatabase) DeleteMessageByID(id uint) error
- func (d *GormDatabase) DeleteMessagesByApplication(applicationID uint) error
- func (d *GormDatabase) DeleteMessagesByUser(userID uint) error
- func (d *GormDatabase) DeleteUserByID(id uint) error
- func (d *GormDatabase) GetApplicationByID(id uint) *model.Application
- func (d *GormDatabase) GetApplicationByToken(token string) *model.Application
- func (d *GormDatabase) GetApplicationsByUser(userID uint) []*model.Application
- func (d *GormDatabase) GetClientByID(id uint) *model.Client
- func (d *GormDatabase) GetClientByToken(token string) *model.Client
- func (d *GormDatabase) GetClientsByUser(userID uint) []*model.Client
- func (d *GormDatabase) GetMessageByID(id uint) *model.Message
- func (d *GormDatabase) GetMessagesByApplication(tokenID uint) []*model.Message
- func (d *GormDatabase) GetMessagesByApplicationSince(appID uint, limit int, since uint) []*model.Message
- func (d *GormDatabase) GetMessagesByUser(userID uint) []*model.Message
- func (d *GormDatabase) GetMessagesByUserSince(userID uint, limit int, since uint) []*model.Message
- func (d *GormDatabase) GetUserByID(id uint) *model.User
- func (d *GormDatabase) GetUserByName(name string) *model.User
- func (d *GormDatabase) GetUsers() []*model.User
- func (d *GormDatabase) UpdateApplication(app *model.Application) error
- func (d *GormDatabase) UpdateUser(user *model.User)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormDatabase ¶
GormDatabase is a wrapper for the gorm framework.
func New ¶
func New(dialect, connection, defaultUser, defaultPass string, strength int, createDefaultUser bool) (*GormDatabase, error)
New creates a new wrapper for the gorm database framework.
func (*GormDatabase) Close ¶
func (d *GormDatabase) Close()
Close closes the gorm database connection.
func (*GormDatabase) CreateApplication ¶
func (d *GormDatabase) CreateApplication(application *model.Application) error
CreateApplication creates an application.
func (*GormDatabase) CreateClient ¶
func (d *GormDatabase) CreateClient(client *model.Client) error
CreateClient creates a client.
func (*GormDatabase) CreateMessage ¶
func (d *GormDatabase) CreateMessage(message *model.Message) error
CreateMessage creates a message.
func (*GormDatabase) CreateUser ¶
func (d *GormDatabase) CreateUser(user *model.User) error
CreateUser creates a user.
func (*GormDatabase) DeleteApplicationByID ¶
func (d *GormDatabase) DeleteApplicationByID(id uint) error
DeleteApplicationByID deletes an application by its id.
func (*GormDatabase) DeleteClientByID ¶
func (d *GormDatabase) DeleteClientByID(id uint) error
DeleteClientByID deletes a client by its id.
func (*GormDatabase) DeleteMessageByID ¶
func (d *GormDatabase) DeleteMessageByID(id uint) error
DeleteMessageByID deletes a message by its id.
func (*GormDatabase) DeleteMessagesByApplication ¶
func (d *GormDatabase) DeleteMessagesByApplication(applicationID uint) error
DeleteMessagesByApplication deletes all messages from an application.
func (*GormDatabase) DeleteMessagesByUser ¶
func (d *GormDatabase) DeleteMessagesByUser(userID uint) error
DeleteMessagesByUser deletes all messages from a user.
func (*GormDatabase) DeleteUserByID ¶
func (d *GormDatabase) DeleteUserByID(id uint) error
DeleteUserByID deletes a user by its id.
func (*GormDatabase) GetApplicationByID ¶
func (d *GormDatabase) GetApplicationByID(id uint) *model.Application
GetApplicationByID returns the application for the given id or nil.
func (*GormDatabase) GetApplicationByToken ¶ added in v1.0.5
func (d *GormDatabase) GetApplicationByToken(token string) *model.Application
GetApplicationByToken returns the application for the given token or nil.
func (*GormDatabase) GetApplicationsByUser ¶
func (d *GormDatabase) GetApplicationsByUser(userID uint) []*model.Application
GetApplicationsByUser returns all applications from a user.
func (*GormDatabase) GetClientByID ¶
func (d *GormDatabase) GetClientByID(id uint) *model.Client
GetClientByID returns the client for the given id or nil.
func (*GormDatabase) GetClientByToken ¶ added in v1.0.5
func (d *GormDatabase) GetClientByToken(token string) *model.Client
GetClientByToken returns the client for the given token or nil.
func (*GormDatabase) GetClientsByUser ¶
func (d *GormDatabase) GetClientsByUser(userID uint) []*model.Client
GetClientsByUser returns all clients from a user.
func (*GormDatabase) GetMessageByID ¶
func (d *GormDatabase) GetMessageByID(id uint) *model.Message
GetMessageByID returns the messages for the given id or nil.
func (*GormDatabase) GetMessagesByApplication ¶
func (d *GormDatabase) GetMessagesByApplication(tokenID uint) []*model.Message
GetMessagesByApplication returns all messages from an application.
func (*GormDatabase) GetMessagesByApplicationSince ¶ added in v1.1.4
func (d *GormDatabase) GetMessagesByApplicationSince(appID uint, limit int, since uint) []*model.Message
GetMessagesByApplicationSince returns limited messages from an application. If since is 0 it will be ignored.
func (*GormDatabase) GetMessagesByUser ¶
func (d *GormDatabase) GetMessagesByUser(userID uint) []*model.Message
GetMessagesByUser returns all messages from a user.
func (*GormDatabase) GetMessagesByUserSince ¶ added in v1.1.4
GetMessagesByUserSince returns limited messages from a user. If since is 0 it will be ignored.
func (*GormDatabase) GetUserByID ¶
func (d *GormDatabase) GetUserByID(id uint) *model.User
GetUserByID returns the user by the given id or nil.
func (*GormDatabase) GetUserByName ¶
func (d *GormDatabase) GetUserByName(name string) *model.User
GetUserByName returns the user by the given name or nil.
func (*GormDatabase) GetUsers ¶
func (d *GormDatabase) GetUsers() []*model.User
GetUsers returns all users.
func (*GormDatabase) UpdateApplication ¶ added in v1.1.3
func (d *GormDatabase) UpdateApplication(app *model.Application) error
UpdateApplication updates an application.
func (*GormDatabase) UpdateUser ¶
func (d *GormDatabase) UpdateUser(user *model.User)
UpdateUser updates a user.