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

Find a better name for Map.Upsert #6059

Closed
dmitryax opened this issue Sep 13, 2022 · 2 comments
Closed

Find a better name for Map.Upsert #6059

dmitryax opened this issue Sep 13, 2022 · 2 comments
Labels
discussion-needed Community discussion needed

Comments

@dmitryax
Copy link
Member

In #5998, we found out that Map.Insert* and Map.Update* methods are not that useful as we probably initially expected and we decided to go with Map.Upsert* that suites all the use cases and can be applied to all the Value types consistently. Having Map.Upsert* alone doesn't seem like the best name pick, so we should consider other names. I see the following options:

  • Map.Put* (Put, PutString, PutSlice, PutMap etc). Inspired by Java and REST API.
  • Map.Store* (Store, StoreString, StoreSlice, StoreMap etc). Inspired by https://pkg.go.dev/sync#Map.Store.
  • Map.Set* (Set, SetString, SetSlice, SetMap etc).

So we need to pick one.

cc @open-telemetry/collector-approvers

@bogdandrutu
Copy link
Member

I think to go well with Get and Remove we can use the Java/REST API conventions and use Put.

@dmitryax
Copy link
Member Author

Put seems like a pretty good option to me as well

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

No branches or pull requests

2 participants