Skip to content

Commit

Permalink
Add DieWith method (#106)
Browse files Browse the repository at this point in the history
DieWith passes the current die to a callback function as a mutable die.
This is usefull to apply predefined functions that operate on the die
while preserving the fluent nature of the api.

Signed-off-by: Scott Andrews <[email protected]>
  • Loading branch information
scothis committed Jul 20, 2023
1 parent b9d05b1 commit 14089ff
Show file tree
Hide file tree
Showing 27 changed files with 2,507 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ type MyResourceDie interface {
// either mutable (`false`) or immutable (`true`).
DieImmutable(immutable bool) *MyResourceDie

// DieWith returns a new die after passing the current die to the callback
// function. The passed die is mutable.
DieWith(fn func(d *MyResourceDie)) *MyResourceDie

// DeepCopy returns a new die with equivalent state. Useful for
// snapshotting a mutable die.
DeepCopy() *MyResourceDie
Expand Down
21 changes: 21 additions & 0 deletions apis/admission/v1/zz_generated.die.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions apis/admissionregistration/v1/zz_generated.die.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions apis/apiextensions/v1/zz_generated.die.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 14089ff

Please sign in to comment.