feat(binding/go): Add ListOptions with recursive support#7605
feat(binding/go): Add ListOptions with recursive support#7605FrankYang0529 wants to merge 4 commits into
Conversation
| * @see opendal_list_options_set_recursive | ||
| */ | ||
| typedef struct opendal_list_options { | ||
| /** |
There was a problem hiding this comment.
There're a few list options in opendal core, I'm wondering why don't expose them all?
https://opendal.incubator.apache.org/docs/rust/opendal/options/struct.ListOptions.html
There was a problem hiding this comment.
I would prefer to do each function in separate PR. WDYT?
7e672a6 to
1b2ab15
Compare
|
Can we use options pattern here? So List and ListWith can be merged. func List(path string, opts ...WithListFn)Sorry for inaccurate description. Sent by my phone. |
Signed-off-by: PoAn Yang <payang@apache.org>
Signed-off-by: PoAn Yang <payang@apache.org>
Signed-off-by: PoAn Yang <payang@apache.org>
Signed-off-by: PoAn Yang <payang@apache.org>
1b2ab15 to
63e50ea
Compare
| // WithRecursive sets the recursive flag for the list operation. | ||
| // | ||
| // When recursive is true, the list operation will descend into sub-directories. | ||
| func WithRecursive(recursive bool) WithListFn { |
There was a problem hiding this comment.
I'd prefer ListWithRecursive here.
| } | ||
|
|
||
| func (o *listOptions) toInner() opendalListOptions { | ||
| return opendalListOptions{recursive: o.recursive} |
There was a problem hiding this comment.
Can we use opendal_list_options_set_recursive here instead of constructing opendalListOptions directly?
I'm afraid mirroring the C struct layout in Go could introduce potential memory/layout risks if opendal_list_options changes later. IMO using the C setter opendal_list_options_set_recursive would keep the ownership and initialization details on the C side.
Which issue does this PR close?
Closes #7604
Rationale for this change
The Go binding's op.List(path) had no way to perform a recursive listing. Users who needed to enumerate all objects under a prefix recursively had to implement their own traversal.
What changes are included in this PR?
Add golang binding
ListWithandListOptions.Are there any user-facing changes?
Users can now perform recursive listings via:
The existing
op.List(path)API is unchanged.AI Usage Statement
This PR was developed with the assistance of OpenCode using the claude-sonnet-4.6 model.