mysqldb

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBConnection = ""
View Source
var MigrationDirectory = ""

Functions

func AddAsset added in v0.0.3

func AddAsset() (*uuid.UUID, error)

func AddProduct added in v0.0.3

func AddProduct(product *models.Product, productUsers *models.ProductUsers) error

func AddProject added in v0.0.3

func AddProject(project models.Project) error

AddProject adds a new project to the database.

func AddSettings

func AddSettings() (*uuid.UUID, error)

func AddUser

func AddUser(name string, email string, passwd string) error

AddUser creates a new user entry in the DB. Whitespaces in the email are automatically deleted Email is a unique attribute, so the function checks for existing email, before adding a new entry

func ConvertToJSONRaw added in v0.0.3

func ConvertToJSONRaw(references interface{}) (*json.RawMessage, error)

func DeleteAsset added in v0.0.3

func DeleteAsset(assetID *uuid.UUID) error

func DeleteProduct added in v0.0.3

func DeleteProduct(productID *uuid.UUID) error

func DeleteSettings

func DeleteSettings(settingsID *uuid.UUID) error

func DeleteUser

func DeleteUser(email string) error

func EmailExists

func EmailExists(email string) (bool, error)

func GetAsset added in v0.0.3

func GetAsset(assetID *uuid.UUID) (*models.Asset, error)

func GetProductByID added in v0.0.3

func GetProductByID(ID uuid.UUID) (*models.Product, error)

func GetProductsByUserID added in v0.0.3

func GetProductsByUserID(userID uuid.UUID) (*[]models.Product, error)

GetProductsByUserID returns all products belonging to the selected user. The function first gets all rows matching with the user DI from users_products table, then gets all products based on the product ids from the first query result.

func GetProjectByName added in v0.0.3

func GetProjectByName(name string) (models.Project, error)

GetProjectByName returns the project by name.

func GetSettings

func GetSettings(settingsID *uuid.UUID) (*models.UserSetting, error)

func GetUserByEmail

func GetUserByEmail(email string) (*models.User, error)

GetUserByEmail returns the user defined by the email.

func GetUserByID added in v0.0.3

func GetUserByID(ID uuid.UUID) (*models.User, error)

GetUserByID returns the user defined by it uuid.

func IsPasswordCorrect added in v0.0.3

func IsPasswordCorrect(password string, user *models.User) bool

CheckPassword compares the password entered by the user with the stored password.

func UpdateAsset added in v0.0.3

func UpdateAsset(asset *models.Asset) error

func UpdateAssetID added in v0.0.3

func UpdateAssetID(user *models.User) error

Adds a new assetID if there is non assigned yet. This only can happen if the user was generated before introduction of assets.

func UpdateProject added in v0.0.3

func UpdateProject(project models.Project) error

UpdateProject updates the selected project.

func UserExists

func UserExists(username string) (bool, error)

Types

type DBInterfaceCommon added in v0.0.3

type DBInterfaceCommon interface {
	BootstrapSystem() error
	ConnectSystem() (*sql.DB, error)
}
var DBInterface DBInterfaceCommon

type DBInterfaceMock added in v0.0.3

type DBInterfaceMock struct {
	Mock sqlmock.Sqlmock
	DB   *sql.DB
}

func (DBInterfaceMock) BootstrapSystem added in v0.0.3

func (DBInterfaceMock) BootstrapSystem() error

func (DBInterfaceMock) ConnectSystem added in v0.0.3

func (i DBInterfaceMock) ConnectSystem() (*sql.DB, error)

type MYSQLInterface added in v0.0.3

type MYSQLInterface struct {
}

func (MYSQLInterface) BootstrapSystem added in v0.0.3

func (MYSQLInterface) BootstrapSystem() error

func (MYSQLInterface) ConnectSystem added in v0.0.3

func (MYSQLInterface) ConnectSystem() (*sql.DB, error)

Jump to

Keyboard shortcuts

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