module

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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

type Database struct {
	Connection *gorm.DB
}

Database struct

func (*Database) AutoConnect

func (db *Database) AutoConnect() error

AutoConnect connects to a MySQL database using loaded configs

func (*Database) Close

func (db *Database) Close() error

Close closes MySQL database connection

func (*Database) Connect

func (db *Database) Connect(dsn model.DSN) error

Connect connects to a MySQL database

func (*Database) CountJobs

func (db *Database) CountJobs(status string) int

CountJobs count jobs by status

func (*Database) CreateJob

func (db *Database) CreateJob(job *model.Job) *model.Job

CreateJob creates a new job

func (*Database) DeleteJobByID

func (db *Database) DeleteJobByID(id int)

DeleteJobByID deletes a job by id

func (*Database) DeleteJobByUUID

func (db *Database) DeleteJobByUUID(uuid string)

DeleteJobByUUID deletes a job by uuid

func (*Database) GetJobByID

func (db *Database) GetJobByID(id int) model.Job

GetJobByID gets a job by id

func (*Database) GetJobByUUID

func (db *Database) GetJobByUUID(uuid string) model.Job

GetJobByUUID gets a job by uuid

func (*Database) GetJobs

func (db *Database) GetJobs() []model.Job

GetJobs gets jobs

func (*Database) GetPendingJobByType

func (db *Database) GetPendingJobByType(jobType string) model.Job

GetPendingJobByType gets a job by uuid

func (*Database) HasTable

func (db *Database) HasTable(table string) bool

HasTable checks if table exists

func (*Database) JobExistByID

func (db *Database) JobExistByID(id int) bool

JobExistByID check if job exists

func (*Database) JobExistByUUID

func (db *Database) JobExistByUUID(uuid string) bool

JobExistByUUID check if job exists

func (*Database) Migrate

func (db *Database) Migrate() bool

Migrate migrates the database

func (*Database) Ping

func (db *Database) Ping() error

Ping check the db connection

func (*Database) ReleaseChildJobs

func (db *Database) ReleaseChildJobs(parentID int)

ReleaseChildJobs count jobs by status

func (*Database) Rollback

func (db *Database) Rollback() bool

Rollback drop tables

func (*Database) UpdateJobByID

func (db *Database) UpdateJobByID(job *model.Job)

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 {
	Timeout time.Duration
}

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

func (*HTTPClient) Put

func (h *HTTPClient) Put(ctx context.Context, endpoint string, data string, parameters, headers map[string]string) (*http.Response, error)

Put http call

func (*HTTPClient) ToString

func (h *HTTPClient) ToString(response *http.Response) (string, error)

ToString response body to string

type LatestRelease

type LatestRelease struct {
	Name    string `json:"name"`
	TagName string `json:"tag_name"`
}

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

func (*Prometheus) Send

func (p *Prometheus) Send(metrics []model.Metric) error

Send sends metrics to prometheus

func (*Prometheus) Summary

func (p *Prometheus) Summary(item model.Metric) error

Summary updates or creates a summary

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL