comment

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package comment provides filtering for Linear comments.

The package implements a filter builder pattern where each filter type (date, entity, text) is handled by a separate function that populates the underlying CommentFilter struct.

Available filters:

  • Date: created-at, updated-at
  • Entity: id, creator, issue
  • Text: body

Index

Constants

This section is empty.

Variables

View Source
var Filters = map[string]FilterFunc{

	"created-at": common.ApplyCreatedAt[*FilterBuilder],
	"updated-at": common.ApplyUpdatedAt[*FilterBuilder],

	"id":      common.ApplyID[*FilterBuilder],
	"creator": ApplyCreator,
	"issue":   ApplyIssue,

	"body": ApplyBody,
}

Filters is the registry of all comment filter functions. Uses shared filters from common package where applicable.

Functions

func ApplyBody

func ApplyBody(ctx context.Context, cmd *cobra.Command, b *FilterBuilder) error

ApplyBody handles --body flag.

func ApplyCreator

func ApplyCreator(ctx context.Context, cmd *cobra.Command, b *FilterBuilder) error

ApplyCreator handles --creator flag.

func ApplyIssue

func ApplyIssue(ctx context.Context, cmd *cobra.Command, b *FilterBuilder) error

ApplyIssue handles --issue flag.

Types

type FilterBuilder

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

FilterBuilder constructs CommentFilter from CLI flags.

func NewFilterBuilder

func NewFilterBuilder(res *resolver.Resolver) *FilterBuilder

NewFilterBuilder creates a FilterBuilder with the given resolver.

func (*FilterBuilder) Build

Build returns the filter if any fields are set, nil otherwise.

func (*FilterBuilder) CreatedAtComparator

func (b *FilterBuilder) CreatedAtComparator() *intgraphql.DateComparator

CreatedAtComparator returns or creates the CreatedAt comparator.

func (*FilterBuilder) Filter

func (b *FilterBuilder) Filter() *intgraphql.CommentFilter

Filter returns the underlying CommentFilter.

func (*FilterBuilder) FromFlags

func (b *FilterBuilder) FromFlags(ctx context.Context, cmd *cobra.Command) error

FromFlags populates the filter from cobra command flags.

func (*FilterBuilder) Parser

func (b *FilterBuilder) Parser() dateparser.Parser

Parser returns the date parser.

func (*FilterBuilder) Resolver

func (b *FilterBuilder) Resolver() *resolver.Resolver

Resolver returns the resolver for entity lookups.

func (*FilterBuilder) SetID

func (b *FilterBuilder) SetID(comp *intgraphql.IDComparator)

SetID sets the ID comparator. Implements common.IDFilterable.

func (*FilterBuilder) UpdatedAtComparator

func (b *FilterBuilder) UpdatedAtComparator() *intgraphql.DateComparator

UpdatedAtComparator returns or creates the UpdatedAt comparator.

type FilterFunc

type FilterFunc func(ctx context.Context, cmd *cobra.Command, b *FilterBuilder) error

FilterFunc applies a filter based on command flags.

Jump to

Keyboard shortcuts

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