Skip to content

[ENHANCEMENT] Interface for adding multiple tags at a time #29

Description

@mtfishman

Currently with the new "named tags" design based on a dictionary, you can add or update a tag using its name with:

i = Index(2)
j = settag(i, "site", "1")

and delete a tag using its name with:

k = unsettag(j, "site")
k == i # true

It might be nice to have a syntax for adding multiple tags at once. Currently, settags is used as an internal function for setting all the tags at once, with existing ones getting removed:

i = Index(2)
j = settag(i, "site", "1")
k = settags(j, Dict(["link" => "3"])) # This is currently only defined in `IndexName` but this is for demonstration purposes
hastag(k, "site") # false

so it is meant to be low-level, and I think it is a good name for that.

Maybe we can use the syntax mergetags, i.e.:

i = Index(2)
j = settag(i, "site", "1")
k = mergetags(j, Dict(["link" => "3"]))
gettag(k, "site") == "1" # true
gettag(k, "link") == "3" # true

following the usage of Base.merge on Base.Dict:

julia> merge(Dict("foo" => 0.0, "bar" => 42.0), Dict("baz" => 17, "bar" => 4711))
Dict{String, Float64} with 3 entries:
  "bar" => 4711.0
  "baz" => 17.0
  "foo" => 0.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions