Skip to content

How can I update map fileds. #587

Description

@v1xingyue

I have some map fields in a Env , and a string content . Env struct is like this :

type Env struct {
    msg string
   fileds map[string]any
}

Now I want to add filed by the msg content , such as .

fileds["len"] = len(msgs)
fileds["uppper"] = uppper(msgs)

At last return the fields to the expr script caller.

How can I do that.

Thanks.

And I wonder why not provide built in much more map functions.

Activity

  1. antonmedv commented on Mar 1, 2024

    @antonmedv
    Member

    I didn’t get the question. Expr doesn’t support assignment operations. You can add them as functions.

  2. locked and limited conversation to collaborators on Mar 1, 2024
  3. converted this issue into a discussion #588 on Mar 1, 2024
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions