From 756ae621bd97a8b776fefb15e5e7e2292f98ee45 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 9 Jul 2026 00:14:33 +0300 Subject: dependencies --- internal/resource/embed/embed.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 internal/resource/embed/embed.go (limited to 'internal/resource/embed') diff --git a/internal/resource/embed/embed.go b/internal/resource/embed/embed.go new file mode 100644 index 0000000..49fe3eb --- /dev/null +++ b/internal/resource/embed/embed.go @@ -0,0 +1,24 @@ +package embed + +// DependsOn is embedded into concrete resource types to give them the ability +// to accumulate dependency IDs supplied via the DependsOn option. +type DependsOn struct { + IDs []string +} + +// AddDependency records a single resource ID this resource depends on. It uses +// a pointer receiver so the mutation is visible to the embedding value. +func (d *DependsOn) AddDependency(id string) { + d.IDs = append(d.IDs, id) +} + +// Absence is embedded into concrete resource types that can be marked for +// removal via the IsAbsent option. It promotes an Absent field and a +// SetAbsent method to the embedding type. +type Absence struct { + Absent bool +} + +// SetAbsent implements opt.Absentable, marking the resource for removal. It +// uses a pointer receiver so the mutation is visible to the embedding value. +func (a *Absence) SetAbsent() { a.Absent = true } -- cgit v1.2.3