Documentation
¶
Overview ¶
Package query contains the shared read-query inputs and operations.
Index ¶
- Constants
- func CoerceBool(value any) bool
- func CoerceString(value any) string
- func CoerceStrings(value any) []string
- func DecodeValue(document []byte) (any, error)
- func Downcase(value string) string
- func InspectSymbol(name string) string
- type Entry
- type Filter
- func (filter Filter) AgentReadyOnly() bool
- func (filter Filter) BodySearch() bool
- func (filter Filter) Contexts() []string
- func (filter Filter) DeferredOnly() bool
- func (filter Filter) DelegatedOnly() bool
- func (filter Filter) IncludeArchive() bool
- func (filter Filter) Priority() string
- func (filter Filter) RecurringOnly() bool
- func (filter Filter) Scope() string
- func (filter Filter) SomedayOnly() bool
- func (filter Filter) State() string
- func (filter Filter) States() []string
- func (filter Filter) Tags() []string
- func (filter Filter) Text() []string
- func (filter Filter) TextQuery() string
- func (filter Filter) UnavailableOnly() bool
- type FilterOptions
- type Object
- type ParsedFilter
Constants ¶
const ( ScopeOpen = "open" ScopeProposed = "proposed" ScopeDone = "done" ScopeArchived = "archived" ScopeAll = "all" )
Variables ¶
This section is empty.
Functions ¶
func CoerceBool ¶
CoerceBool mirrors Ruby's `!!value`, the coercion TaskFilter#initialize applies to every boolean keyword. Only nil and false are false in Ruby: `0` and `""` are truthy, so JSON falsiness must not be mapped onto it.
func CoerceString ¶
CoerceString mirrors Ruby's `value.to_s`, the coercion TaskFilter#initialize applies to scope, priority, and state before any domain rule sees them. A dynamic boundary applies it so a non-String value is rejected by the ported domain message rather than by a decoder.
func CoerceStrings ¶
CoerceStrings mirrors Ruby's `Array(values).map { |value| value.to_s }`, the coercion TaskFilter#initialize applies to contexts, tags, and text before any other rule sees them. Go's typed constructor cannot express it, so dynamic boundaries (the JSON kwargs probe, and later any dynamic adapter) apply this rule before building FilterOptions rather than rejecting the input.
The value is a JSON document decoded into Go's generic shapes, with numbers preserved as json.Number so integers stay integers as they do in Ruby.
func DecodeValue ¶
DecodeValue decodes one JSON document into the shapes this file renders: nil, bool, string, json.Number, []any, and Object. It is the only decoder a dynamic boundary may use — `encoding/json`'s generic decode loses both Hash order and the distinction between an integer and a float literal.
func Downcase ¶
Downcase is Ruby's String#downcase, which strings.ToLower alone is not: it applies the one unconditional multi-character mapping and the case pairs added in Unicode versions newer than Go's tables. Every surface that folds case for comparison — the text filter, the title index, ref resolution — goes through here, so there is one place for that difference to live.
func InspectSymbol ¶
InspectSymbol mirrors Ruby's Symbol#inspect, which is how the interpreter renders an unrecognised keyword name in the ArgumentError it raises before TaskFilter#initialize runs. A name the parser would accept as a symbol literal prints bare; anything else is quoted with String#inspect.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is the immutable selection input shared by read adapters.
func NewFilter ¶
func NewFilter(options FilterOptions) (Filter, error)
NewFilter validates and normalizes one filter value.
func (Filter) AgentReadyOnly ¶
func (Filter) BodySearch ¶
func (Filter) DeferredOnly ¶
func (Filter) DelegatedOnly ¶
func (Filter) IncludeArchive ¶
func (Filter) RecurringOnly ¶
func (Filter) SomedayOnly ¶
func (Filter) UnavailableOnly ¶
type FilterOptions ¶
type FilterOptions struct {
Scope *string `json:"scope"`
DeferredOnly bool `json:"deferred_only"`
SomedayOnly bool `json:"someday_only"`
RecurringOnly bool `json:"recurring_only"`
BodySearch bool `json:"body_search"`
DelegatedOnly bool `json:"delegated_only"`
AgentReadyOnly bool `json:"agent_ready_only"`
Contexts []string `json:"contexts"`
Tags []string `json:"tags"`
Priority *string `json:"priority"`
State *string `json:"state"`
Text []string `json:"text"`
}
FilterOptions supplies Filter's constructor fields.
type Object ¶
type Object []Entry
Object is a Ruby Hash as it arrives from JSON. Ruby's Hash preserves insertion order and JSON.parse inserts in document order, so `to_s` renders keys in the order the caller wrote them. A Go map cannot carry that order, so the boundary decoder produces this instead and no map ever reaches the rendering below.
type ParsedFilter ¶
type ParsedFilter struct {
// contains filtered or unexported fields
}
ParsedFilter is the legacy list syntax plus its JSON rendering switch.
func ParseCLI ¶
func ParseCLI(args []string) (ParsedFilter, error)
ParseCLI translates the legacy list arguments into a Filter.
func (ParsedFilter) Filter ¶
func (parsed ParsedFilter) Filter() Filter
func (ParsedFilter) JSON ¶
func (parsed ParsedFilter) JSON() bool