dependents

package
v1.8.1 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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. It also finds the campaigns, automation emails and templates that show a discount code pool's codes (Coupon, M59).

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"
	// KindTemplate is a saved template or section: only Coupon lists them
	// (the discount code pool's page has its own kinds).
	KindTemplate = "template"
)

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.

func Coupon

func Coupon(ctx context.Context, q Querier, ws uuid.UUID, slug string) ([]Use, error)

Coupon lists what shows the discount code pool slug's codes: Liquid that reads it ({{ coupons.welcome15.code }}) or a Discount code block set to it (<!-- rc:coupon {"pool":"welcome15",…} -->). Each user is listed once.

Jump to

Keyboard shortcuts

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