Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - support metadata (depth 1) #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ashleymichal
Copy link
Contributor

No description provided.

@@ -34,4 +36,6 @@ pub struct KeyValuePair {
pub expiration: Option<i64>,
pub expiration_ttl: Option<i64>,
pub base64: Option<bool>,
// a temporary hack for basic metadata
pub metadata: Option<HashMap<String, String>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a meaningful distinction here between a hashmap with no values, and not having a hashmap?

If not, I think

#[serde(default)]
pub metadata: HashMap<String, String>,

makes more sense, because otherwise you're doing two checks (is option.IsSome, then hashmap.IsEmpty) but this way you eliminate the optional check, and you can safely, idk, loop or map over the hashmap without worrying about the nil case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have played with the API a bit today and realize there is actually no limitation on the shape of the metadata at all (e.g. a numeric array is also accepted). Would it be a bad idea to set it as a HashMap in this case?

@edmundhung
Copy link
Member

Hello! I am a wrangler user and realise the metadata support have to come from the rust library here. May I ask if there are any blockers/concerns on supporting it? I would be happy to give it a try if possible :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants