lib

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMatches = map[string]*regexp.Regexp{
	"go_test":  regexp.MustCompile("(.*)/?go test(.*)"),
	"go_build": regexp.MustCompile("(.*)/?go build(.*)"),
}

Functions

func CreateLabelFromCommand

func CreateLabelFromCommand(cmd *exec.Cmd, cm CmdMatcher) (string, error)

CreateLabelFromCommand takes a command and distills it into a label that we measure. We want to know the command and the package it pertains to.

func FindRepo

func FindRepo(env *CommandEnv) error

func InContainer

func InContainer() (bool, error)

InContainer looks in the cgroup and mountinfo to see if there are signs this is running in a container.

Types

type CmdMatcher

type CmdMatcher struct {
	// contains filtered or unexported fields
}

func NewCmdMatcher

func NewCmdMatcher(matchers map[string]*regexp.Regexp) CmdMatcher

func (CmdMatcher) FindMatch

func (cm CmdMatcher) FindMatch(cmd string) string

type CommandEnv

type CommandEnv struct {
	Repo      string
	Branch    string
	User      string
	OS        string
	Container bool
}

func NewCommandEnv

func NewCommandEnv() (*CommandEnv, error)

func (CommandEnv) String

func (ce CommandEnv) String()

type JSONCondition

type JSONCondition struct {
	Column   string `json:"column"`
	Operator string `json:"operator"`
	Value    string `json:"value"`
}

func (JSONCondition) String

func (jc JSONCondition) String() string

type JSONOrderBy

type JSONOrderBy struct {
	Column string `json:"column"`
	Order  string `json:"order"`
}

func (JSONOrderBy) String

func (job JSONOrderBy) String() string

type JSONQuery

type JSONQuery struct {
	Operation  string          `json:"operation"`
	Table      string          `json:"table"`
	Conditions []JSONCondition `json:"conditions"`
	OrderBy    []JSONOrderBy   `json:"orderBy"`
}

func NewJSONQueryFromQuery

func NewJSONQueryFromQuery(query string) (*JSONQuery, error)

func (*JSONQuery) Query

func (jq *JSONQuery) Query(db *gorm.DB) ([]models.Record, error)

func (JSONQuery) String

func (jq JSONQuery) String() string

Jump to

Keyboard shortcuts

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