Skip to content

Commit

Permalink
[0.3.0-draft] add fields.get-and-delete
Browse files Browse the repository at this point in the history
This saves the user from having to use `get` followed by `delete` if they want
access to the values they're removing.

Signed-off-by: Joel Dice <[email protected]>
  • Loading branch information
dicej committed Mar 18, 2024
1 parent 13dad38 commit 58c24fb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions wit/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ interface types {
/// syntactically invalid.
delete: func(name: field-key) -> result<_, header-error>;

/// Delete all values for a key. Does nothing if no values for the key
/// exist.
///
/// Returns all values previously corresponding to the key, if any.
///
/// Fails with `header-error.immutable` if the `fields` are immutable.
///
/// Fails with `header-error.invalid-syntax` if the `field-key` is
/// syntactically invalid.
get-and-delete: func(name: field-key) -> result<list<field-value>, header-error>;

/// Append a value for a key. Does not change or delete any existing
/// values for that key.
///
Expand Down

0 comments on commit 58c24fb

Please sign in to comment.