Documentation ¶
Index ¶
- Variables
- func RollbackWithErrorStack(tx *sql.Tx, errorStack error) error
- type MYSQLConnector
- type MYSQLFunctions
- func (*MYSQLFunctions) AddResource(resource *models.Resource, tx *sql.Tx) error
- func (*MYSQLFunctions) DeleteResource(resourceID string, tx *sql.Tx) 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 (*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) UpdateResource(resource *models.Resource, tx *sql.Tx) error
Constants ¶
This section is empty.
Variables ¶
View Source
var AddResourceQuery = "INSERT INTO resources (id, category, content) VALUES (UUID_TO_BIN(?), ?, ?)"
View Source
var DeleteResourceQuery = "DELETE FROM resources WHERE id=UUID_TO_BIN(?)"
View Source
var ErrResourcesMissing = errors.New("This resources is missing or old value is the same as new")
View Source
var GetCategorsQuery = "SELECT id, name, description FROM categories"
View Source
var GetCategoryByIDQuery = "SELECT id, name, description FROM categories WHERE id = ?"
View Source
var GetCategoryByNameQuery = "SELECT id, name, description FROM categories WHERE name = ?"
View Source
var GetResourceByCategoryQuery = "SELECT BIN_TO_UUID(id), category, content FROM resources WHERE category = ? ORDER BY created_at DESC"
View Source
var GetResourceByIDQuery = "SELECT BIN_TO_UUID(id), category, content FROM resources WHERE id = UUID_TO_BIN(?)"
View Source
var GetResourcesByIDsQuery = "SELECT BIN_TO_UUID(id), category, content FROM resources WHERE id IN (UUID_TO_BIN(?)"
View Source
var UpdateResourceQuery = "UPDATE resources set content = ?, category = ? where id = UUID_TO_BIN(?)"
Functions ¶
Types ¶
type MYSQLConnector ¶
MYSQL database connector implementation
func (*MYSQLConnector) BootstrapSystem ¶
func (c *MYSQLConnector) BootstrapSystem() error
func (*MYSQLConnector) ConnectSystem ¶
func (c *MYSQLConnector) ConnectSystem() (*sql.Tx, error)
type MYSQLFunctions ¶
type MYSQLFunctions struct {
DBConnector *MYSQLConnector
}
MYSQLFunctions represents the implementation of MYSQL data manipulation functions.
func (*MYSQLFunctions) AddResource ¶
func (*MYSQLFunctions) DeleteResource ¶
func (*MYSQLFunctions) DeleteResource(resourceID string, tx *sql.Tx) error
func (*MYSQLFunctions) GetCategories ¶
func (f *MYSQLFunctions) GetCategories() ([]models.Category, error)
func (*MYSQLFunctions) GetCategoryByID ¶
func (f *MYSQLFunctions) GetCategoryByID(id int) (*models.Category, error)
func (*MYSQLFunctions) GetCategoryByName ¶
func (f *MYSQLFunctions) GetCategoryByName(name string) (*models.Category, error)
func (*MYSQLFunctions) GetResourceByID ¶
func (*MYSQLFunctions) GetResourcesByCategory ¶
func (*MYSQLFunctions) GetResourcesByIDs ¶
func (*MYSQLFunctions) UpdateResource ¶
Click to show internal directories.
Click to hide internal directories.