Skip to content

Commit

Permalink
Go: XGROUP DESTROY. (valkey-io#2974)
Browse files Browse the repository at this point in the history
* Go: `XGROUP CREATE`.

Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand authored and EdricCua committed Jan 23, 2025
1 parent 931f2eb commit 75a3cb7
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions go/api/base_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2831,14 +2831,43 @@ func (client *baseClient) XGroupSetIdWithOptions(
return handleStringResponse(result)
}

// Destroys the consumer group `group` for the stream stored at `key`.
//
// See [valkey.io] for details.
//
// Parameters:
//
// key - The key of the stream.
// group - The consumer group name to delete.
//
// Return value:
//
// `true` if the consumer group is destroyed. Otherwise, `false`.
//
// Example:
//
// ok, err := client.XGroupDestroy("mystream", "mygroup")
// if !ok || err != nil {
// // handle errors
// }
//
// [valkey.io]: https://valkey.io/commands/xgroup-destroy/
func (client *baseClient) XGroupDestroy(key string, group string) (bool, error) {
result, err := client.executeCommand(C.XGroupDestroy, []string{key, group})
if err != nil {
return defaultBoolResponse, err
}
return handleBoolResponse(result)
}

// Sets the last delivered ID for a consumer group.
//
// See [valkey.io] for details.
//
// Parameters:
//
// key - The key of the stream.
// group - The newly created consumer group name.
// group - The consumer group name.
// id - The stream entry ID that should be set as the last delivered ID for the consumer group.
//
// Return value:
Expand All @@ -2864,7 +2893,7 @@ func (client *baseClient) XGroupSetId(key string, group string, id string) (stri
// Parameters:
//
// key - The key of the stream.
// group - The newly created consumer group name.
// group - The consumer group name.
// id - The stream entry ID that should be set as the last delivered ID for the consumer group.
// opts - The options for the command. See [options.XGroupSetIdOptions] for details.
//
Expand Down

0 comments on commit 75a3cb7

Please sign in to comment.