dependents

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package dependents finds what uses a custom field or a segment before it is deleted (review 2026-11 AU-11): segments, forms, scoring rules, automations, campaigns not sent yet (with their SMS, push and WhatsApp content), digests, saved views, transactional templates and Liquid in their content (AU-18). A form's confirmation email is built from its branding and the contact's first name only, so it names no custom field. It reads each kind once and matches in memory, so a page listing every field asks a handful of queries.

Index

Constants

View Source
const (
	KindSegment    = "segment"
	KindForm       = "form"
	KindScoring    = "scoring"
	KindAutomation = "automation"
	KindCampaign   = "campaign"
	KindDigest     = "digest"
	KindView       = "view"
	// KindTransactional is a transactional template, its draft or live
	// version (review 2026-11 AU-18).
	KindTransactional = "transactional"
)

Kinds of users.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

Index holds a workspace's candidates.

func Load

func Load(ctx context.Context, q Querier, ws uuid.UUID) (Index, error)

Load reads the workspace's segments, forms, scoring rules, automations, unsent campaigns, digests, saved views and transactional templates. A row's deleted_at, where the table has one, leaves it out.

func (Index) Field

func (idx Index) Field(key string) []Use

Field lists what uses the custom field key: a segment or automation condition on it ("custom:plan"), a form or scoring rule that sets or reads it ("field": "plan" or "key": "plan"), Liquid ({{ contact.plan }}), a saved view's column, or a SQL segment naming it.

func (Index) Segment

func (idx Index) Segment(id uuid.UUID) []Use

Segment lists what uses the segment id: campaigns and digests sending to it, automations triggered by or checking it, saved views filtering on it, and segments built on it.

type Querier

type Querier interface {
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
}

Querier runs a query (a pool or a transaction).

type Use

type Use struct {
	Kind string `json:"kind" enum:"segment,form,scoring,automation,campaign,digest,view,transactional"`
	ID   string `json:"id"`
	Name string `json:"name"`
}

Use is one thing that would stop working without the field or segment.

Jump to

Keyboard shortcuts

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