Documentation ¶
Index ¶
- Constants
- type Database
- func (db *Database) AutoConnect() error
- func (db *Database) Close() error
- func (db *Database) Connect(dsn model.DSN) error
- func (db *Database) CountJobs(status string) int
- func (db *Database) CreateJob(job *model.Job) *model.Job
- func (db *Database) DeleteJobByID(id int)
- func (db *Database) DeleteJobByUUID(uuid string)
- func (db *Database) GetJobByID(id int) model.Job
- func (db *Database) GetJobByUUID(uuid string) model.Job
- func (db *Database) GetJobs() []model.Job
- func (db *Database) GetPendingJobByType(jobType string) model.Job
- func (db *Database) HasTable(table string) bool
- func (db *Database) JobExistByID(id int) bool
- func (db *Database) JobExistByUUID(uuid string) bool
- func (db *Database) Migrate() bool
- func (db *Database) Ping() error
- func (db *Database) ReleaseChildJobs(parentID int)
- func (db *Database) Rollback() bool
- func (db *Database) UpdateJobByID(job *model.Job)
- type FileSystem
- type HTTPClient
- func (h *HTTPClient) BuildData(parameters map[string]string) string
- func (h *HTTPClient) BuildParameters(endpoint string, parameters map[string]string) (string, error)
- func (h *HTTPClient) Delete(ctx context.Context, endpoint string, parameters, headers map[string]string) (*http.Response, error)
- func (h *HTTPClient) Get(ctx context.Context, endpoint string, parameters, headers map[string]string) (*http.Response, error)
- func (h *HTTPClient) GetStatusCode(response *http.Response) int
- func (h *HTTPClient) Post(ctx context.Context, endpoint string, data string, ...) (*http.Response, error)
- func (h *HTTPClient) Put(ctx context.Context, endpoint string, data string, ...) (*http.Response, error)
- func (h *HTTPClient) ToString(response *http.Response) (string, error)
- type LatestRelease
Constants ¶
const ReleaseURL = "https://api.github.com/repos/Clivern/Beetle/releases/latest"
ReleaseURL remote release URL
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
Database struct
func (*Database) AutoConnect ¶
AutoConnect connects to a MySQL database using loaded configs
func (*Database) DeleteJobByID ¶
DeleteJobByID deletes a job by id
func (*Database) DeleteJobByUUID ¶
DeleteJobByUUID deletes a job by uuid
func (*Database) GetJobByID ¶
GetJobByID gets a job by id
func (*Database) GetJobByUUID ¶
GetJobByUUID gets a job by uuid
func (*Database) GetPendingJobByType ¶
GetPendingJobByType gets a job by uuid
func (*Database) JobExistByID ¶
JobExistByID check if job exists
func (*Database) JobExistByUUID ¶
JobExistByUUID check if job exists
func (*Database) ReleaseChildJobs ¶
ReleaseChildJobs count jobs by status
func (*Database) UpdateJobByID ¶
UpdateJobByID updates a job by ID
type FileSystem ¶
type FileSystem struct{}
FileSystem struct
func (*FileSystem) DirExists ¶
func (fs *FileSystem) DirExists(path string) bool
DirExists reports whether the dir exists
func (*FileSystem) EnsureDir ¶
func (fs *FileSystem) EnsureDir(dirName string, mode int) (bool, error)
EnsureDir ensures that directory exists
func (*FileSystem) FileExists ¶
func (fs *FileSystem) FileExists(path string) bool
FileExists reports whether the named file exists
func (*FileSystem) PathExists ¶
func (fs *FileSystem) PathExists(path string) bool
PathExists reports whether the path exists
type HTTPClient ¶
type HTTPClient struct{}
HTTPClient struct
func NewHTTPClient ¶
func NewHTTPClient() *HTTPClient
NewHTTPClient creates an instance of http client
func (*HTTPClient) BuildData ¶
func (h *HTTPClient) BuildData(parameters map[string]string) string
BuildData build body data
func (*HTTPClient) BuildParameters ¶
BuildParameters add parameters to URL
func (*HTTPClient) Delete ¶
func (h *HTTPClient) Delete(ctx context.Context, endpoint string, parameters, headers map[string]string) (*http.Response, error)
Delete http call
func (*HTTPClient) Get ¶
func (h *HTTPClient) Get(ctx context.Context, endpoint string, parameters, headers map[string]string) (*http.Response, error)
Get http call
func (*HTTPClient) GetStatusCode ¶
func (h *HTTPClient) GetStatusCode(response *http.Response) int
GetStatusCode response status code
func (*HTTPClient) Post ¶
func (h *HTTPClient) Post(ctx context.Context, endpoint string, data string, parameters, headers map[string]string) (*http.Response, error)
Post http call
type LatestRelease ¶
LatestRelease struct
func GetLatestRelease ¶
func GetLatestRelease() (LatestRelease, error)
GetLatestRelease gets the latest beetle release
func (*LatestRelease) ConvertToJSON ¶
func (lr *LatestRelease) ConvertToJSON() (string, error)
ConvertToJSON convert object to json
func (*LatestRelease) LoadFromJSON ¶
func (lr *LatestRelease) LoadFromJSON(data []byte) (bool, error)
LoadFromJSON update object from json