filter

package
v0.0.0-...-f4c9d17 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovedExpression

type ApprovedExpression struct {
	Comparison ComparisonOperator `@("==" | ">" | ">=" | "<" | "<=")?`
	Count      int                `@Int`
}

type BinaryOperator

type BinaryOperator int
const (
	BinaryOperatorBoth BinaryOperator = iota
	BinaryOperatorEither
)

func (*BinaryOperator) Capture

func (o *BinaryOperator) Capture(s []string) error

type ComparisonOperator

type ComparisonOperator int
const (
	ComparisonOperatorEqual ComparisonOperator = iota
	ComparisonOperatorLess
	ComparisonOperatorLessOrEqual
	ComparisonOperatorGreaterOrEqual
	ComparisonOperatorGreater
)

func (*ComparisonOperator) Capture

func (c *ComparisonOperator) Capture(s []string) error

type Expression

type Expression struct {
	Left  *Term           `@@`
	Right []*OperatorTerm `( @@ )*`
}

func NewExpression

func NewExpression(filter string) (*Expression, error)

func (*Expression) BuildFilter

func (e *Expression) BuildFilter() model.MergeReqFilter

type FilterInfo

type FilterInfo struct {
	Expression string
	Matcher    model.MergeReqFilter
	Error      error
}

func BuildFilter

func BuildFilter(filterexpr string) FilterInfo

type Match

type Match struct {
	Project          *StringPattern      `"p" @@`
	RealName         *StringPattern      `| "n" @@`
	UserName         *StringPattern      `| "u" @@`
	Age              *Time               `| "a" @@`
	Activity         *Time               `| "t" @@`
	Approved         *ApprovedExpression `| "v" @@`
	ApproverRealName *StringPattern      `| "vn" @@`
	ApproverUserName *StringPattern      `| "vu" @@`
	ReviewerRealName *StringPattern      `| "rn" @@`
	ReviewerUserName *StringPattern      `| "ru" @@`
	State            *State              `| "s" @("o" | "c" | "m" | "l" |
                                           "open" | "closed" | "merged" | "locked")`
	Status *Status `| "m" @("n" | "u" | "o" | "r" |
                                "new" | "updated" | "old" | "read")`
	Label        *StringPattern `| "l" @@`
	WIP          bool           `| @"w"`
	TargetBranch *StringPattern `| "b" @@`
	ID           *ProjectID     `| "i" @@`
}

func (*Match) BuildFilter

func (m *Match) BuildFilter() model.MergeReqFilter

type OperatorTerm

type OperatorTerm struct {
	Operator BinaryOperator `@("&" | "|")`
	Term     *Term          `@@`
}

type PatternFlag

type PatternFlag int
const (
	PatternFlagCaseFold PatternFlag = iota
	PatternFlagGlob
)

func (*PatternFlag) Capture

func (f *PatternFlag) Capture(str []string) error

type ProjectID

type ProjectID struct {
	Project *String `@@?`
	Value   int     `@Int`
}

type State

type State int
const (
	StateOpened State = iota
	StateClosed
	StateMerged
	StateLocked
)

func (*State) AsState

func (s *State) AsState() model.MergeReqState

func (*State) Capture

func (s *State) Capture(str []string) error

type Status

type Status int
const (
	StatusNew Status = iota
	StatusUpdated
	StatusOld
	StatusRead
)

func (*Status) AsStatus

func (s *Status) AsStatus() model.MergeReqStatus

func (*Status) Capture

func (s *Status) Capture(str []string) error

type String

type String struct {
	Bare         *string `@BareString`
	SingleQuoted *string `| @SingleQuotedString`
	DoubleQuoted *string `| @DoubleQuotedString`
}

func (*String) AsString

func (t *String) AsString() string

type StringPattern

type StringPattern struct {
	Value *String              `@@`
	Flags []*StringPatternFlag `@@*`
}

func (*StringPattern) AsString

func (p *StringPattern) AsString() string

func (*StringPattern) HasFlag

func (p *StringPattern) HasFlag(f PatternFlag) bool

type StringPatternFlag

type StringPatternFlag struct {
	Flag *PatternFlag `@("/i" | "/g")`
}

type Term

type Term struct {
	Operator      *UnaryOperator `@("!")?`
	Match         *Match         `("~" @@`
	SubExpression *Expression    ` | "(" @@ ")")`
}

func (*Term) BuildFilter

func (t *Term) BuildFilter() model.MergeReqFilter

type Time

type Time struct {
	Value int      `@Int`
	Unit  TimeUnit `` /* 337-byte string literal not displayed */

}

func (*Time) AsDuration

func (t *Time) AsDuration() time.Duration

type TimeUnit

type TimeUnit int
const (
	TimeUnitYear TimeUnit = iota
	TimeUnitMonth
	TimeUnitWeek
	TimeUnitDay
	TimeUnitHour
	TimeUnitMinute
	TimeUnitSecond
)

func (*TimeUnit) Capture

func (f *TimeUnit) Capture(str []string) error

type UnaryOperator

type UnaryOperator int
const (
	UnaryOperatorReject UnaryOperator = iota
)

func (*UnaryOperator) Capture

func (o *UnaryOperator) Capture(s []string) error

Jump to

Keyboard shortcuts

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