Documentation ¶
Index ¶
- type GormDatabase
- func (d *GormDatabase) Close()
- func (d *GormDatabase) CountUser(condition ...interface{}) (int, error)
- 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) CreatePluginConf(p *model.PluginConf) 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) DeletePluginConfByID(id uint) error
- func (d *GormDatabase) DeleteUserByID(id uint) error
- func (d *GormDatabase) GetApplicationByID(id uint) (*model.Application, error)
- func (d *GormDatabase) GetApplicationByToken(token string) (*model.Application, error)
- func (d *GormDatabase) GetApplicationsByUser(userID uint) ([]*model.Application, error)
- func (d *GormDatabase) GetClientByID(id uint) (*model.Client, error)
- func (d *GormDatabase) GetClientByToken(token string) (*model.Client, error)
- func (d *GormDatabase) GetClientsByUser(userID uint) ([]*model.Client, error)
- func (d *GormDatabase) GetMessageByID(id uint) (*model.Message, error)
- func (d *GormDatabase) GetMessagesByApplication(tokenID uint) ([]*model.Message, error)
- func (d *GormDatabase) GetMessagesByApplicationSince(appID uint, limit int, since uint) ([]*model.Message, error)
- func (d *GormDatabase) GetMessagesByUser(userID uint) ([]*model.Message, error)
- func (d *GormDatabase) GetMessagesByUserSince(userID uint, limit int, since uint) ([]*model.Message, error)
- func (d *GormDatabase) GetPluginConfByApplicationID(appid uint) (*model.PluginConf, error)
- func (d *GormDatabase) GetPluginConfByID(id uint) (*model.PluginConf, error)
- func (d *GormDatabase) GetPluginConfByToken(token string) (*model.PluginConf, error)
- func (d *GormDatabase) GetPluginConfByUser(userid uint) ([]*model.PluginConf, error)
- func (d *GormDatabase) GetPluginConfByUserAndPath(userid uint, path string) (*model.PluginConf, error)
- func (d *GormDatabase) GetUserByID(id uint) (*model.User, error)
- func (d *GormDatabase) GetUserByName(name string) (*model.User, error)
- func (d *GormDatabase) GetUsers() ([]*model.User, error)
- func (d *GormDatabase) Ping() error
- func (d *GormDatabase) UpdateApplication(app *model.Application) error
- func (d *GormDatabase) UpdateClient(client *model.Client) error
- func (d *GormDatabase) UpdatePluginConf(p *model.PluginConf) error
- func (d *GormDatabase) UpdateUser(user *model.User) error
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, createDefaultUserIfNotExist 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) CountUser ¶
func (d *GormDatabase) CountUser(condition ...interface{}) (int, error)
CountUser returns the user count which satisfies the given condition.
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) CreatePluginConf ¶
func (d *GormDatabase) CreatePluginConf(p *model.PluginConf) error
CreatePluginConf creates a new plugin configuration
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) DeletePluginConfByID ¶
func (d *GormDatabase) DeletePluginConfByID(id uint) error
DeletePluginConfByID deletes a plugin configuration by its id.
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, error)
GetApplicationByID returns the application for the given id or nil.
func (*GormDatabase) GetApplicationByToken ¶
func (d *GormDatabase) GetApplicationByToken(token string) (*model.Application, error)
GetApplicationByToken returns the application for the given token or nil.
func (*GormDatabase) GetApplicationsByUser ¶
func (d *GormDatabase) GetApplicationsByUser(userID uint) ([]*model.Application, error)
GetApplicationsByUser returns all applications from a user.
func (*GormDatabase) GetClientByID ¶
func (d *GormDatabase) GetClientByID(id uint) (*model.Client, error)
GetClientByID returns the client for the given id or nil.
func (*GormDatabase) GetClientByToken ¶
func (d *GormDatabase) GetClientByToken(token string) (*model.Client, error)
GetClientByToken returns the client for the given token or nil.
func (*GormDatabase) GetClientsByUser ¶
func (d *GormDatabase) GetClientsByUser(userID uint) ([]*model.Client, error)
GetClientsByUser returns all clients from a user.
func (*GormDatabase) GetMessageByID ¶
func (d *GormDatabase) GetMessageByID(id uint) (*model.Message, error)
GetMessageByID returns the messages for the given id or nil.
func (*GormDatabase) GetMessagesByApplication ¶
func (d *GormDatabase) GetMessagesByApplication(tokenID uint) ([]*model.Message, error)
GetMessagesByApplication returns all messages from an application.
func (*GormDatabase) GetMessagesByApplicationSince ¶
func (d *GormDatabase) GetMessagesByApplicationSince(appID uint, limit int, since uint) ([]*model.Message, error)
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, error)
GetMessagesByUser returns all messages from a user.
func (*GormDatabase) GetMessagesByUserSince ¶
func (d *GormDatabase) GetMessagesByUserSince(userID uint, limit int, since uint) ([]*model.Message, error)
GetMessagesByUserSince returns limited messages from a user. If since is 0 it will be ignored.
func (*GormDatabase) GetPluginConfByApplicationID ¶
func (d *GormDatabase) GetPluginConfByApplicationID(appid uint) (*model.PluginConf, error)
GetPluginConfByApplicationID gets plugin configuration by its internal appid.
func (*GormDatabase) GetPluginConfByID ¶
func (d *GormDatabase) GetPluginConfByID(id uint) (*model.PluginConf, error)
GetPluginConfByID gets plugin configuration by plugin ID
func (*GormDatabase) GetPluginConfByToken ¶
func (d *GormDatabase) GetPluginConfByToken(token string) (*model.PluginConf, error)
GetPluginConfByToken gets plugin configuration by plugin token
func (*GormDatabase) GetPluginConfByUser ¶
func (d *GormDatabase) GetPluginConfByUser(userid uint) ([]*model.PluginConf, error)
GetPluginConfByUser gets plugin configurations from a user
func (*GormDatabase) GetPluginConfByUserAndPath ¶
func (d *GormDatabase) GetPluginConfByUserAndPath(userid uint, path string) (*model.PluginConf, error)
GetPluginConfByUserAndPath gets plugin configuration by user and file name
func (*GormDatabase) GetUserByID ¶
func (d *GormDatabase) GetUserByID(id uint) (*model.User, error)
GetUserByID returns the user by the given id or nil.
func (*GormDatabase) GetUserByName ¶
func (d *GormDatabase) GetUserByName(name string) (*model.User, error)
GetUserByName returns the user by the given name or nil.
func (*GormDatabase) GetUsers ¶
func (d *GormDatabase) GetUsers() ([]*model.User, error)
GetUsers returns all users.
func (*GormDatabase) Ping ¶
func (d *GormDatabase) Ping() error
Ping pings the database to verify the connection.
func (*GormDatabase) UpdateApplication ¶
func (d *GormDatabase) UpdateApplication(app *model.Application) error
UpdateApplication updates an application.
func (*GormDatabase) UpdateClient ¶
func (d *GormDatabase) UpdateClient(client *model.Client) error
UpdateClient updates a client.
func (*GormDatabase) UpdatePluginConf ¶
func (d *GormDatabase) UpdatePluginConf(p *model.PluginConf) error
UpdatePluginConf updates plugin configuration
func (*GormDatabase) UpdateUser ¶
func (d *GormDatabase) UpdateUser(user *model.User) error
UpdateUser updates a user.