new feature: Add delete options support for Go binding
enhancementreleases-note/featbindings/go
### Feature Description
Add DeleteOptions support to the Go binding's Delete operation.
Currently, the Go binding only exposes:
```
func (op *Operator) Delete(path string) error
```
The Rust core supports two additional options via `DeleteOptions`:
* version — delete a specific version of an object (useful for versioned storage backends such as S3 versioning, GCS object versioning)
* recursive — recursively delete all objects under a given path prefix
The Go binding should expose an equivalent `DeleteWith` function (or functional options pattern consistent with the existing `List` options style) to support these options.
### Problem and Solution
Users of the Go binding who work with versioned storage backends (e.g. S3 with versioning enabled) cannot delete a specific version of an object. They also cannot perform a recursive delete without manually listing and deleting each object, which is error-prone and inefficient.
The Rust core already supports both capabilities via `DeleteOptions`:
```
// core/src/types/operator/operator_futures.rs
pub struct DeleteOptions {
pub version: Option<String>,
pub recursive: bool,
}
```
Solution:
Implement `DeleteWith` in the Go binding using the same functional options pattern already used by `ListWith`:
```
// Option types
type DeleteOption func(*deleteOptions)
type deleteOptions struct {
version string
recursive bool
}
func DeleteWithVersion(version string) DeleteOption {
return func(o *deleteOptions) { o.version = version }
}
func DeleteWithRecursive() DeleteOption {
return func(o *deleteOptions) { o.recursive = true }
}
// New method on Operator
func (op *Operator) DeleteWith(path string, opts ...DeleteOption) error
```
### Additional Context
_No response_
### Are you willing to contribute to the development of this feature?
- [x] Yes, I am willing to contribute to the development of this feature.
关闭于 2026-06-04 0 条评论