search

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package search compiles the inventory query language into parameterised SQL. Queries are whitespace-separated terms that must all match:

example.com            substring of name, CN, subject, issuer or a SAN
issuer:DigiCert        field substring match
expires:<30d           expires within 30 days (also >, <=, >=, dates)
algorithm:rsa          key algorithm
tag:production         exact tag
type:cert|key|ca|leaf  object kind
-tag:legacy            negation

Values may be quoted: subject:"Example Org".

Index

Constants

This section is empty.

Variables

View Source
var Fields = []string{"name", "cn", "subject", "issuer", "san", "serial", "fingerprint", "spki", "algorithm",
	"key", "tag", "type", "expires", "status", "ca", "source", "id"}

Fields lists the supported field names for help and completion.

Functions

This section is empty.

Types

type Clause

type Clause struct {
	Where string
	Args  []any
}

Clause is a WHERE fragment with bound arguments.

type Compiled

type Compiled struct {
	Certs *Clause
	Keys  *Clause
	SSH   *Clause
}

Compiled holds SQL fragments for each object kind. A nil Where for a kind means that kind cannot match the query.

func Compile

func Compile(q string, now time.Time) (*Compiled, error)

Compile parses q. now is used for relative expiry expressions.

Jump to

Keyboard shortcuts

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