filter

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type CreateOptions added in v0.18.0

type CreateOptions struct {
	Hosts []host.Host
}

CreateOptions defines additional dependencies or values of Factory.

type Factory

type Factory interface {
	CreatePreClone(opts CreateOptions, params params.Params) (Filter, error)
	CreatePostClone(opts CreateOptions, params params.Params) (Filter, error)
	Name() string
}

type File

type File struct {
	Op    string
	Paths []string
}

func (*File) Do

func (fe *File) Do(ctx context.Context) (bool, error)

func (*File) String

func (fe *File) String() string

type FileContent

type FileContent struct {
	Path   string
	Regexp *regexp.Regexp
}

func (*FileContent) Do

func (fcl *FileContent) Do(ctx context.Context) (bool, error)

func (*FileContent) String

func (fcl *FileContent) String() string

type FileContentFactory

type FileContentFactory struct{}

func (FileContentFactory) CreatePostClone added in v0.18.0

func (f FileContentFactory) CreatePostClone(_ CreateOptions, params params.Params) (Filter, error)

func (FileContentFactory) CreatePreClone added in v0.18.0

func (f FileContentFactory) CreatePreClone(opts CreateOptions, params params.Params) (Filter, error)

func (FileContentFactory) Name

func (f FileContentFactory) Name() string

type FileFactory

type FileFactory struct{}

func (FileFactory) CreatePostClone added in v0.18.0

func (f FileFactory) CreatePostClone(_ CreateOptions, params params.Params) (Filter, error)

func (FileFactory) CreatePreClone added in v0.18.0

func (f FileFactory) CreatePreClone(opts CreateOptions, params params.Params) (Filter, error)

func (FileFactory) Name

func (f FileFactory) Name() string

type Filter

type Filter interface {
	Do(context.Context) (bool, error)
	String() string
}

type FilterRepository

type FilterRepository interface {
	Host() host.HostDetail
	ID() int64
	Name() string
	Owner() string
}

type GitlabCodeSearch added in v0.18.0

type GitlabCodeSearch struct {
	GroupID any
	Host    host.GitLabSearcher
	Query   string
	// contains filtered or unexported fields
}

GitlabCodeSearch filters repositories. It executes a code search query against GitLab and stores the IDs of the projects returned. A repository matches if the list of IDs contains the ID of the repository.

func (*GitlabCodeSearch) Do added in v0.18.0

func (s *GitlabCodeSearch) Do(ctx context.Context) (bool, error)

Do implements Filter.

func (*GitlabCodeSearch) String added in v0.18.0

func (s *GitlabCodeSearch) String() string

String implements Filter.

type GitlabCodeSearchFactory added in v0.18.0

type GitlabCodeSearchFactory struct{}

GitlabCodeSearchFactory creates gitlabCodeSearch filters.

func (GitlabCodeSearchFactory) CreatePostClone added in v0.18.0

func (f GitlabCodeSearchFactory) CreatePostClone(_ CreateOptions, _ params.Params) (Filter, error)

func (GitlabCodeSearchFactory) CreatePreClone added in v0.18.0

func (f GitlabCodeSearchFactory) CreatePreClone(opts CreateOptions, params params.Params) (Filter, error)

Create implements Factory.

func (GitlabCodeSearchFactory) Name added in v0.18.0

Name implements Factory.

type Jq added in v0.15.0

type Jq struct {
	Exprs       []*gojq.Code
	ExprsString string
	Path        string
}

Jq is a filter that applies a jq expression to a file in the repository.

func (*Jq) Do added in v0.15.0

func (jq *Jq) Do(ctx context.Context) (bool, error)

Do implements Filter. It reads a file in a cloned repository and queries it via a jq expression. It returns true if the query returns at least one node.

func (*Jq) String added in v0.15.0

func (f *Jq) String() string

String implements Filter.

type JqFactory added in v0.15.0

type JqFactory struct{}

JqFactory creates jq filters.

func (JqFactory) CreatePostClone added in v0.18.0

func (f JqFactory) CreatePostClone(_ CreateOptions, params params.Params) (Filter, error)

Create implements Factory.

func (JqFactory) CreatePreClone added in v0.18.0

func (f JqFactory) CreatePreClone(_ CreateOptions, params params.Params) (Filter, error)

func (JqFactory) Name added in v0.15.0

func (f JqFactory) Name() string

Name implements Factory.

type Repository

type Repository struct {
	Host  *regexp.Regexp
	Owner *regexp.Regexp
	Repo  *regexp.Regexp
}

func (*Repository) Do

func (r *Repository) Do(ctx context.Context) (bool, error)

func (*Repository) String

func (r *Repository) String() string

type RepositoryFactory

type RepositoryFactory struct{}

func (RepositoryFactory) CreatePostClone added in v0.18.0

func (f RepositoryFactory) CreatePostClone(_ CreateOptions, params params.Params) (Filter, error)

func (RepositoryFactory) CreatePreClone added in v0.18.0

func (f RepositoryFactory) CreatePreClone(_ CreateOptions, params params.Params) (Filter, error)

func (RepositoryFactory) Name

func (f RepositoryFactory) Name() string

type Reverse

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

Reverse takes the result of a wrapped filter and returns the opposite.

func NewReverse

func NewReverse(wrapped Filter) *Reverse

NewReverse returns a new Reverse filter.

func (*Reverse) Do

func (r *Reverse) Do(ctx context.Context) (bool, error)

Do implements Filter

func (*Reverse) String

func (r *Reverse) String() string

String implements Filter

type Xpath added in v0.13.0

type Xpath struct {
	Exprs []*xpath.Expr
	Path  string
}

Xpath filters repositories by applying an XPath expression to a file in the repository.

func (*Xpath) Do added in v0.13.0

func (x *Xpath) Do(ctx context.Context) (bool, error)

Do implements Filter. It reads a XML document in a cloned repository and queries it via an XPath expression. It returns true if the XPath expression returns at least one node.

func (*Xpath) String added in v0.13.0

func (x *Xpath) String() string

String implements Filter.

type XpathFactory added in v0.13.0

type XpathFactory struct{}

XpathFactory creates Xpath filters.

func (XpathFactory) CreatePostClone added in v0.18.0

func (f XpathFactory) CreatePostClone(_ CreateOptions, params params.Params) (Filter, error)

Create implements Factory.

func (XpathFactory) CreatePreClone added in v0.18.0

func (f XpathFactory) CreatePreClone(_ CreateOptions, params params.Params) (Filter, error)

func (XpathFactory) Name added in v0.13.0

func (f XpathFactory) Name() string

Name implements Factory.

Jump to

Keyboard shortcuts

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