jql

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package jql builds and composes Jira Query Language strings from structured inputs. It is pure string logic — no cobra, config, or I/O — so the jql/search/issue command layers and shell completion can all share one query builder without import cycles.

Index

Constants

View Source
const DefaultIssueListJQL = "updated >= -365d ORDER BY updated DESC"

DefaultIssueListJQL is the bounded default query used when an issue list is requested with no filters and no explicit sort. It is owned here, in the query domain, and consumed by the Jira issue service as its List default.

Variables

This section is empty.

Functions

func CombineClauses

func CombineClauses(lhs, rhs string) string

CombineClauses AND-joins two JQL fragments, dropping either side when blank.

func CompactStrings

func CompactStrings(values []string) []string

CompactStrings returns values with empty/whitespace-only entries dropped and the rest trimmed.

func IssueList

func IssueList(raw string, builder BuildOptions) (string, error)

IssueList combines a raw JQL string with the builder's structured filters. A non-empty raw query is parenthesized and AND-ed beneath the filters, preserving any top-level ORDER BY suffix. An empty raw query falls back to Build.

func ParenthesizeIfTopLevelOR

func ParenthesizeIfTopLevelOR(query string) string

ParenthesizeIfTopLevelOR wraps query in parentheses only when it contains a top-level OR, so AND-composition with another clause keeps the original precedence.

func SplitTopLevelOrderBy

func SplitTopLevelOrderBy(query string) (string, string)

SplitTopLevelOrderBy splits query into the filter portion and a leading-space " ORDER BY ..." suffix (empty when there is no top-level ORDER BY).

Types

type BuildOptions

type BuildOptions struct {
	Projects   []string
	Epics      []string
	Assignee   string
	Reporter   string
	Statuses   []string
	Priorities []string
	Labels     []string
	IssueTypes []string
	OrderBy    string
	Descending bool
}

BuildOptions captures the structured filters that compose into a JQL query.

func (BuildOptions) Build

func (o BuildOptions) Build() (string, error)

Build renders the options into a complete JQL query (with ORDER BY). With no filters and no explicit sort it returns the default bounded issue list.

Jump to

Keyboard shortcuts

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