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) 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) GetHeaderValue(response *http.Response, key string) string
- func (h *HTTPClient) GetStatusCode(response *http.Response) int
- func (h *HTTPClient) Patch(ctx context.Context, endpoint string, data string, ...) (*http.Response, error)
- 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
- type Prometheus
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 ¶
HTTPClient struct
func NewHTTPClient ¶
func NewHTTPClient(timeout int) *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) 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) GetHeaderValue ¶
func (h *HTTPClient) GetHeaderValue(response *http.Response, key string) string
GetHeaderValue get response header value
func (*HTTPClient) GetStatusCode ¶
func (h *HTTPClient) GetStatusCode(response *http.Response) int
GetStatusCode response status code
func (*HTTPClient) Patch ¶
func (h *HTTPClient) Patch(ctx context.Context, endpoint string, data string, parameters, headers map[string]string) (*http.Response, error)
Patch http call
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
type Prometheus ¶
type Prometheus struct{}
Prometheus struct
func NewPrometheus ¶
func NewPrometheus() *Prometheus
NewPrometheus create a new instance of prometheus backend
func (*Prometheus) Counter ¶
func (p *Prometheus) Counter(item model.Metric) error
Counter updates or creates a counter
func (*Prometheus) Gauge ¶
func (p *Prometheus) Gauge(item model.Metric) error
Gauge updates or creates a gauge
func (*Prometheus) Histogram ¶
func (p *Prometheus) Histogram(item model.Metric) error
Histogram updates or creates a histogram