Help us shape the future of Go! Take the 2026 Go Developer Survey

inuse

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package inuse is the one shape of a refused removal (ADR 0049): a row that live work still uses is not removed, and the refusal names the users. Each domain module returns an *Error from its delete; each API surface renders it as its contract's InUseProblem (409, `usedBy`).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// What is the removed row, for the message.
	What  Subject
	Users []User
}

Error is a removal refused because Users still use the row. Callers match it with As.

func As

func As(err error) (*Error, bool)

As reports the refusal an error carries, if it is one.

func (*Error) Error

func (e *Error) Error() string

type Kind

type Kind string

Kind is what a user of a row is.

const (
	// Broadcast is a Broadcast that has not finished sending.
	Broadcast Kind = "broadcast"
	// Automation is an Automation: one whose steps use the row, or an active one.
	Automation Kind = "automation"
	// Segment is a Segment whose rule names the row.
	Segment Kind = "segment"
	// Rule is an active Rule that uses the row: through a Condition leaf or an Action.
	Rule Kind = "rule"
	// Enrollment stands for the Enrollments of an Automation: one User naming the
	// Automation, with their Count.
	Enrollment Kind = "enrollment"
	// Firing stands for the Firings of a Rule: one User naming the Rule, with their Count.
	Firing Kind = "firing"
	// Message stands for the Outbound messages an Automation has sent: one User naming the
	// Automation, with their Count.
	Message Kind = "message"
)

The kinds of live user a removal can find; each has a value of the contract's UsedByKind.

type Subject

type Subject string

Subject is the row a refused removal was for.

const (
	SubjectSegment       Subject = "segment"
	SubjectTag           Subject = "tag"
	SubjectIntegration   Subject = "integration"
	SubjectSendingDomain Subject = "sending domain"
	SubjectAutomation    Subject = "automation"
	SubjectRule          Subject = "rule"
)

The rows a removal can be refused for; the text reads "<subject> is in use by ...".

type User

type User struct {
	Kind Kind
	ID   int64
	Name string
	// Count is how many rows an Enrollment, Firing or Message User stands for; every other kind is one row and
	// leaves it zero.
	Count int
}

User is one row that uses the row a removal was refused for.

func Broadcasts

func Broadcasts(rows []*ent.Broadcast) []User

Broadcasts maps Broadcasts to their Users, in the order given.

func Enrollments

func Enrollments(automationID int64, name string, count int) User

Enrollments is the User that stands for count Enrollments of the Automation.

func Firings

func Firings(ruleID int64, name string, count int) User

Firings is the User that stands for count Firings of the Rule.

func Messages

func Messages(automationID int64, name string, count int) User

Messages is the User that stands for count Outbound messages the Automation has sent.

func Rules

func Rules(rows []*ent.Rule) []User

Rules maps Rules to their Users, in the order given.

Jump to

Keyboard shortcuts

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