Documentation ¶
Index ¶
- type DBConnector
- func (db *DBConnector) CheckFile(filename string) bool
- func (db *DBConnector) Close()
- func (db *DBConnector) CreateAppModule(name, comment string, initialStatus bool) (*interfaces.AppModuleEntry, error)
- func (db *DBConnector) CreateSession(username string, expire int64) (*interfaces.SessionEntry, error)
- func (db *DBConnector) CreateTask(resource, name, resources, initiatorID string, ...) (*interfaces.TaskEntry, error)
- func (db *DBConnector) CreateUser(username, password, fullName string, isAdmin, isBlocked bool) (*interfaces.UserEntry, error)
- func (db *DBConnector) DeleteExpireSession() error
- func (db *DBConnector) DeleteSessionByUUID(uuid string) error
- func (db *DBConnector) DeleteUserByID(id string) error
- func (db *DBConnector) DownloadFile(filename string) []byte
- func (db *DBConnector) GetAllAppModules() ([]interfaces.AppModuleEntry, error)
- func (db *DBConnector) GetAllTasks() ([]interfaces.TaskEntry, error)
- func (db *DBConnector) GetAllUsers() ([]interfaces.UserEntry, error)
- func (db *DBConnector) GetAppModuleByID(id string) (*interfaces.AppModuleEntry, error)
- func (db *DBConnector) GetAppModuleByName(name string) (*interfaces.AppModuleEntry, error)
- func (db *DBConnector) GetLastCompleteTaskByResourceAndName(resource, name string) (*interfaces.TaskEntry, error)
- func (db *DBConnector) GetSessionByUUID(uuid string) (*interfaces.SessionEntry, error)
- func (db *DBConnector) GetTaskByID(id string) (*interfaces.TaskEntry, error)
- func (db *DBConnector) GetUserByID(id string) (*interfaces.UserEntry, error)
- func (db *DBConnector) GetUserByUsername(name string) (*interfaces.UserEntry, error)
- func (db *DBConnector) GetWaitingTask() (*interfaces.TaskEntry, error)
- func (db *DBConnector) UpdateAppModuleByID(id string, entry *interfaces.AppModuleEntry) error
- func (db *DBConnector) UpdateSessionByUUID(uuid string, entry *interfaces.SessionEntry) error
- func (db *DBConnector) UpdateTaskStatusAtStartup() error
- func (db *DBConnector) UpdateTaskStatusByID(id, newStatus string) error
- func (db *DBConnector) UpdateUserByID(id string, entry *interfaces.UserEntry) error
- func (db *DBConnector) UploadFile(path, filename string) error
- func (db *DBConnector) СheckIfTaskAlreadyCreate(resource, name string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBConnector ¶
DBConnector describes the structure of the connector and implements the Database interface.
func New ¶
func New(dsn, databaseName string, l logging.Logger) (*DBConnector, error)
New return a new connector.
func (*DBConnector) CheckFile ¶
func (db *DBConnector) CheckFile(filename string) bool
CheckFile check file in database.
func (*DBConnector) CreateAppModule ¶
func (db *DBConnector) CreateAppModule(name, comment string, initialStatus bool) (*interfaces.AppModuleEntry, error)
CreateAppModule creates module with given parameters.
func (*DBConnector) CreateSession ¶
func (db *DBConnector) CreateSession(username string, expire int64) (*interfaces.SessionEntry, error)
CreateSession creates session with given parameters.
func (*DBConnector) CreateTask ¶
func (db *DBConnector) CreateTask(resource, name, resources, initiatorID string, onlyResource, selectedResource bool) (*interfaces.TaskEntry, error)
CreateTask creates task with given parameters.
func (*DBConnector) CreateUser ¶
func (db *DBConnector) CreateUser(username, password, fullName string, isAdmin, isBlocked bool) (*interfaces.UserEntry, error)
CreateUser creates user with given parameters.
func (*DBConnector) DeleteExpireSession ¶
func (db *DBConnector) DeleteExpireSession() error
DeleteExpireSession delete all expire session.
func (*DBConnector) DeleteSessionByUUID ¶
func (db *DBConnector) DeleteSessionByUUID(uuid string) error
DeleteSessionByUUID delete session by given uuid.
func (*DBConnector) DeleteUserByID ¶
func (db *DBConnector) DeleteUserByID(id string) error
DeleteUserByID delete user by given id.
func (*DBConnector) DownloadFile ¶
func (db *DBConnector) DownloadFile(filename string) []byte
DownloadFile downloads file from database.
func (*DBConnector) GetAllAppModules ¶
func (db *DBConnector) GetAllAppModules() ([]interfaces.AppModuleEntry, error)
GetAllAppModules return all modules.
func (*DBConnector) GetAllTasks ¶
func (db *DBConnector) GetAllTasks() ([]interfaces.TaskEntry, error)
GetAllTasks return all tasks.
func (*DBConnector) GetAllUsers ¶
func (db *DBConnector) GetAllUsers() ([]interfaces.UserEntry, error)
GetAllUsers return all users.
func (*DBConnector) GetAppModuleByID ¶
func (db *DBConnector) GetAppModuleByID(id string) (*interfaces.AppModuleEntry, error)
GetAppModuleByID return module by given id.
func (*DBConnector) GetAppModuleByName ¶
func (db *DBConnector) GetAppModuleByName(name string) (*interfaces.AppModuleEntry, error)
GetAppModuleByName return module by given name.
func (*DBConnector) GetLastCompleteTaskByResourceAndName ¶
func (db *DBConnector) GetLastCompleteTaskByResourceAndName(resource, name string) (*interfaces.TaskEntry, error)
GetLastCompleteTaskByResourceAndName return last completed task for given resource.
func (*DBConnector) GetSessionByUUID ¶
func (db *DBConnector) GetSessionByUUID(uuid string) (*interfaces.SessionEntry, error)
GetSessionByUUID return session by given uuid.
func (*DBConnector) GetTaskByID ¶
func (db *DBConnector) GetTaskByID(id string) (*interfaces.TaskEntry, error)
GetTaskByID return task by given id.
func (*DBConnector) GetUserByID ¶
func (db *DBConnector) GetUserByID(id string) (*interfaces.UserEntry, error)
GetUserByID return user by given id.
func (*DBConnector) GetUserByUsername ¶
func (db *DBConnector) GetUserByUsername(name string) ( *interfaces.UserEntry, error)
GetUserByUsername return user by given name.
func (*DBConnector) GetWaitingTask ¶
func (db *DBConnector) GetWaitingTask() (*interfaces.TaskEntry, error)
GetWaitingTask return one task with 'waiting' status.
func (*DBConnector) UpdateAppModuleByID ¶
func (db *DBConnector) UpdateAppModuleByID(id string, entry *interfaces.AppModuleEntry) error
UpdateAppModuleByID update module by given id.
func (*DBConnector) UpdateSessionByUUID ¶
func (db *DBConnector) UpdateSessionByUUID(uuid string, entry *interfaces.SessionEntry) error
UpdateSessionByUUID update session by given uuid.
func (*DBConnector) UpdateTaskStatusAtStartup ¶
func (db *DBConnector) UpdateTaskStatusAtStartup() error
UpdateTaskStatusAtStartup update tasks with status 'InProgress' to 'Error'.
func (*DBConnector) UpdateTaskStatusByID ¶
func (db *DBConnector) UpdateTaskStatusByID(id, newStatus string) error
UpdateTaskStatusByID update task status by given id.
func (*DBConnector) UpdateUserByID ¶
func (db *DBConnector) UpdateUserByID(id string, entry *interfaces.UserEntry) error
UpdateUserByID update user by given id.
func (*DBConnector) UploadFile ¶
func (db *DBConnector) UploadFile(path, filename string) error
UploadFile uploads file to database.
func (*DBConnector) СheckIfTaskAlreadyCreate ¶
func (db *DBConnector) СheckIfTaskAlreadyCreate(resource, name string) bool
СheckIfTaskAlreadyCreate checks for the existence of a task with an error or completed status.