I am trying to append values to arrays inside of a map:
var MyMap map[string]Example
type Example struct {
Id []int
Name []string
}
Here is what i tried but i can not point to an object of Example to append to arrays.
package main
import (
"fmt"
)
type Example struct {
Id []int
Name []string
}
func (data *Example) AppendExample(id int,name string) {
data.Id = append(data.Id, id)
data.Name = append(data.Name, name)
}
var MyMap map[string]Example
func main() {
MyMap = make(map[string]Example)
MyMap["key1"] = Oferty.AppendExample(1,"SomeText")
fmt.Println(MyMap)
}