I want to get two data structs into a golang nested template, I've created a struct like this for 'url' and for 'user' data like so,
type url struct {
id string
Userid string
Long_url string
Short_url string
}
type user struct {
Email string
First_name string
Last_name string
Password []byte
}
I want to get the two sets of data into a nested golang template. The user data is just one set of data and the url struct will have many rows of data.
My idea is that I would create another struct like so,
type Data struct {
UU []url
User []user
}
and then do the following,
bb := []url{urls}
tu := []user{u}
data := &Data{bb, tu}
tp.ExecuteTemplate(w, "form", data)
the output of the url data is like this,
[{2 123 https://confluence.expedia.biz/display/INFRAENG/Graphite+Infrastructure short2} {1 123 https://tour.golang.org/moretypes/13 short}]
the error I get is as follows:
error: "cannot use urls (type []url) as type url in array or slice literal"
I'm really not sure how to progress, can you help?