database

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2018 License: MIT Imports: 8 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormDatabase

type GormDatabase struct {
	DB *gorm.DB
}

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

func (d *GormDatabase) GetMessagesByUserSince(userID uint, limit int, since uint) []*model.Message

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL