I want to store values in a struct. I have multiple set of datas and while iterating those set of data, I have to store those sets into struct. I should also have the previous stored data along with the currently stored.
Please find the code i am using
package main
import (
"fmt"
)
type saveDetails struct {
ID string
Grade string
Regular string
OpeningKey string
}
func main() {
tagsList := []saveDetails {}
results = [{ {1000000001 A Regular JOBOp123}} { {1000000002 B Regular JOBOp234}} { {1000000003 C Regular JOBOp456}}]
for _, details := range results {
tagsList = append(tagsList, saveDetails {ID: details.ID, Grade:details.Grade, Regular:details.Regular, OpeningKey:details.OpeningKey})
}
fmt.Println("saveDetails :",tagsList )
}
Please help me in resolving this issue. I am new to this array and structs in golang. I am not sure whether i could use the append function. It could be very much helpful if i get an working code.