Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Go API: Get value attributes as a slice #670

Closed
verdverm opened this issue Jan 24, 2021 · 3 comments
Closed

Go API: Get value attributes as a slice #670

verdverm opened this issue Jan 24, 2021 · 3 comments
Labels
FeatureRequest New feature or request

Comments

@verdverm
Copy link
Contributor

verdverm commented Jan 24, 2021

Is your feature request related to a problem? Please describe.

I'd like to retrieve all the attributes for a value as a slice for further processing within my application. The current API does not allow this and requires knowing the key (https://pkg.go.dev/cuelang.org/[email protected]/cue#Value.Attribute). The same applies for retrieving the key/value pairs from an attribute, which is of more interest to extract actually. The POC returns the key/value pairs for an attribute as a Go map.

My users can specify a regex so I cannot know the keys beforehand and thus the need for extra processing.

Describe the solution you'd like

#529 is a POC

Describe alternatives you've considered

The API does not support this. I currently maintain a small patch to expose the above.

@verdverm verdverm added the FeatureRequest New feature or request label Jan 24, 2021
@verdverm
Copy link
Contributor Author

@mpvl would the query proposal (#165) support searching attributes?

@mpvl
Copy link
Contributor

mpvl commented Jan 29, 2021

@verdverm Very likely not. By doing so attributes would matter for evaluation. The whole purpose of attributes is that they are not part of the language.

The only thing imagine is that one could analyze CUE in the tooling layer, including getting attributes. But they should not influence regular evaluation.

@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#670.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

@cueckoo cueckoo closed this as completed Jul 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants