dbservice

package
v0.0.5-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBService

type DBService struct {
	// contains filtered or unexported fields
}

func New

func (*DBService) AddBuildDefinition

func (ds *DBService) AddBuildDefinition(bd *entity.BuildDefinition) (uint, error)

AddBuildDefinition adds a new build definition

func (*DBService) AddBuildExecution

func (ds *DBService) AddBuildExecution(be *entity.BuildExecution) error

AddBuildExecution adds a new build execution

func (*DBService) AddUser

func (ds *DBService) AddUser(user entity.User) (uint, error)

AddUser adds a new user

func (*DBService) AddUserAction

func (ds *DBService) AddUserAction(action entity.UserAction) error

AddUserAction creates a given user action

func (*DBService) AddVariable

func (ds *DBService) AddVariable(userVar entity.UserVariable) (uint, error)

func (*DBService) AutoMigrate

func (ds *DBService) AutoMigrate() error

AutoMigrate makes sure the database tables exist, corresponding to the supplied structs

func (*DBService) DeleteBuildDefinition

func (ds *DBService) DeleteBuildDefinition(bd *entity.BuildDefinition) error

DeleteBuildDefinition removes a build definition

func (*DBService) DeleteUser

func (ds *DBService) DeleteUser(id uint) error

DeleteUser removes a user by the given Id

func (*DBService) DeleteVariable

func (ds *DBService) DeleteVariable(id uint) error

func (*DBService) FindBuildDefinition

func (ds *DBService) FindBuildDefinition(cond string, args ...interface{}) (entity.BuildDefinition, error)

FindBuildDefinition looks for a specific build definition

func (*DBService) FindBuildExecutions

func (ds *DBService) FindBuildExecutions(query interface{}, args ...interface{}) ([]entity.BuildExecution, error)

FindBuildExecutions finds build executions by criteria

func (*DBService) FindUser

func (ds *DBService) FindUser(cond string, args ...interface{}) (entity.User, error)

FindUser finds a user by the supplied criteria

func (*DBService) FindVariable

func (ds *DBService) FindVariable(cond string, args ...interface{}) (entity.UserVariable, error)

func (*DBService) GetAllBuildDefinitions

func (ds *DBService) GetAllBuildDefinitions() ([]entity.BuildDefinition, error)

GetAllBuildDefinitions fetches all build definitions

func (*DBService) GetAllSettings

func (ds *DBService) GetAllSettings() (map[string]string, error)

GetAllSettings fetches all settings

func (*DBService) GetAllUsers

func (ds *DBService) GetAllUsers() ([]entity.User, error)

GetAllUsers fetches a list of all users

func (*DBService) GetAvailableVariablesForUser

func (ds *DBService) GetAvailableVariablesForUser(userId uint) ([]entity.UserVariable, error)

GetAvailableVariablesForUser determines all available variables for a user by the given Id

func (*DBService) GetBuildDefCaption

func (ds *DBService) GetBuildDefCaption(id uint) (string, error)

GetBuildDefCaption fetches the caption of a given build definition id It is to be used in templates

func (*DBService) GetBuildDefinitionById

func (ds *DBService) GetBuildDefinitionById(id uint) (entity.BuildDefinition, error)

GetBuildDefinitionById fetches a build definition by Id

func (*DBService) GetBuildExecutionById

func (ds *DBService) GetBuildExecutionById(id int) (entity.BuildExecution, error)

GetBuildExecutionById fetches a specific build execution by id

func (*DBService) GetNewestBuildDefinitions

func (ds *DBService) GetNewestBuildDefinitions(limit int) ([]entity.BuildDefinition, error)

GetNewestBuildDefinitions fetches the most recently edited or added build definitions

func (*DBService) GetNewestBuildExecutions

func (ds *DBService) GetNewestBuildExecutions(limit int, query string, args ...interface{}) ([]entity.BuildExecution, error)

GetNewestBuildExecutions fetches the newest build executions

func (*DBService) GetUserActionByToken

func (ds *DBService) GetUserActionByToken(token string) (entity.UserAction, error)

GetUserActionByToken retrieves a specific user action by token

func (*DBService) GetUserByEmail

func (ds *DBService) GetUserByEmail(email string) (entity.User, error)

GetUserByEmail fetches a user by email address

func (*DBService) GetUserById

func (ds *DBService) GetUserById(id uint) (entity.User, error)

GetUserById fetches a user by Id

func (*DBService) GetUsernameById

func (ds *DBService) GetUsernameById(id int) string

GetUsernameById fetches a username by Id Supposed to be used in templates

func (*DBService) GetVariable

func (ds *DBService) GetVariable(id int) (entity.UserVariable, error)

func (*DBService) InsertUserAction

func (ds *DBService) InsertUserAction(userId uint, purpose, token string, validity sql.NullTime) error

InsertUserAction adds a new user action

func (*DBService) InvalidatePasswordResets

func (ds *DBService) InvalidatePasswordResets(userId uint) error

InvalidatePasswordResets invalidates all user action of type 'password_reset'

func (*DBService) Quit

func (ds *DBService) Quit()

Quit ends the database connection

func (*DBService) RowExists

func (ds *DBService) RowExists(query string, args ...interface{}) bool

RowExists takes an SQL query and return true, if at least one entry exists for the given query

func (*DBService) SetSetting

func (ds *DBService) SetSetting(name, value string) error

SetSetting sets a new value for a given setting

func (*DBService) UpdateBuildDefinition

func (ds *DBService) UpdateBuildDefinition(bd *entity.BuildDefinition) error

UpdateBuildDefinition updates a build definition

func (*DBService) UpdateBuildExecution

func (ds *DBService) UpdateBuildExecution(be *entity.BuildExecution) error

UpdateBuildExecution alters an existing user

func (*DBService) UpdateUser

func (ds *DBService) UpdateUser(user entity.User) error

UpdateUser alters an existing user

func (*DBService) UpdateUserAction

func (ds *DBService) UpdateUserAction(userAction entity.UserAction) error

UpdateUserAction updates a given user action

func (*DBService) UpdateVariable

func (ds *DBService) UpdateVariable(userVar entity.UserVariable) error

Jump to

Keyboard shortcuts

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