search

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package search answers the command palette (review 2026-11 FE-1): one call searches campaigns, contacts, automations, lists, segments, signup forms and website pages by name, five of a kind. A kind the caller's role can't open is never searched, so results never show what they can't open.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(h huma.API, s *Service)

Register adds the search operation. Any member may call it; each kind is searched only with the permission that opens it.

Types

type SearchGroup

type SearchGroup struct {
	Kind  string      `json:"kind" enum:"campaigns,contacts,automations,lists,segments,forms,pages"`
	Items []SearchHit `json:"items"`
}

SearchGroup is one kind's results.

type SearchHit

type SearchHit struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	// Status is the item's own status word (sent, draft, live…), for the
	// web app to phrase.
	Status string `json:"status,omitempty"`
	// Detail is a secondary line that needs no translating: a contact's
	// name, a form's kind.
	Detail string `json:"detail,omitempty"`
	// Channel is a campaign's channel (email, sms, push, whatsapp).
	Channel string `json:"channel,omitempty"`
	// Count is a campaign's recipients, a list's subscribed contacts or a
	// segment's last count.
	Count *int64     `json:"count,omitempty"`
	At    *time.Time `json:"at,omitempty" doc:"A campaign's start, or its scheduled time"`
	// Slug is a page's address.
	Slug string `json:"slug,omitempty"`
}

SearchHit is one result.

type SearchResults

type SearchResults struct {
	Query  string        `json:"query"`
	Groups []SearchGroup `json:"groups"`
}

SearchResults is a search's answer, kinds in a fixed order, empty kinds left out.

type Service

type Service struct {
	Q *store.Queries
}

Service runs searches.

func (*Service) Search

Search finds q in every kind the principal may open.

Jump to

Keyboard shortcuts

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