Versions in this module Expand all Collapse all v0 v0.0.0 Mar 29, 2021 Changes in this version + var AddResourceQuery = "INSERT INTO resources (id, category, content) VALUES (UUID_TO_BIN(?), ?, ?)" + var DeleteResourceQuery = "DELETE FROM resources WHERE id=UUID_TO_BIN(?)" + var ErrResourcesMissing = errors.New("This resources is missing or old value is the same as new") + var GetCategorsQuery = "SELECT id, name, description FROM categories" + var GetCategoryByIDQuery = "SELECT id, name, description FROM categories WHERE id = ?" + var GetCategoryByNameQuery = "SELECT id, name, description FROM categories WHERE name = ?" + var GetResourceByCategoryQuery = "SELECT BIN_TO_UUID(id), category, content FROM resources WHERE category = ? ORDER BY created_at DESC" + var GetResourceByIDQuery = "SELECT BIN_TO_UUID(id), category, content FROM resources WHERE id = UUID_TO_BIN(?)" + var GetResourcesByIDsQuery = "SELECT BIN_TO_UUID(id), category, content FROM resources WHERE id IN (UUID_TO_BIN(?)" + var UpdateResourceQuery = "UPDATE resources set content = ?, category = ? where id = UUID_TO_BIN(?)" + func RollbackWithErrorStack(tx *sql.Tx, errorStack error) error + type MYSQLConnector struct + DBConnection string + MigrationDirectory string + func (*MYSQLConnector) Commit(tx *sql.Tx) error + func (*MYSQLConnector) Rollback(tx *sql.Tx) error + func (c *MYSQLConnector) BootstrapSystem() error + func (c *MYSQLConnector) ConnectSystem() (*sql.Tx, error) + type MYSQLFunctions struct + DBConnector *MYSQLConnector + func (*MYSQLFunctions) AddResource(resource *models.Resource, tx *sql.Tx) error + func (*MYSQLFunctions) DeleteResource(resourceID string, tx *sql.Tx) error + func (*MYSQLFunctions) GetResourcesByCategory(category int, tx *sql.Tx) ([]models.Resource, error) + func (*MYSQLFunctions) GetResourcesByIDs(IDs []uuid.UUID, tx *sql.Tx) ([]models.Resource, error) + func (f *MYSQLFunctions) GetCategories() ([]models.Category, error) + func (f *MYSQLFunctions) GetCategoryByID(id int) (*models.Category, error) + func (f *MYSQLFunctions) GetCategoryByName(name string) (*models.Category, error) + func (f *MYSQLFunctions) GetResourceByID(resourceID *uuid.UUID) (*models.Resource, error) + func (f *MYSQLFunctions) UpdateResource(resource *models.Resource, tx *sql.Tx) error