I have a struct.
type DataKey struct {
Id int64 `db:"id"`
UserId string `db:"user_id"`
Data string `db:"data"`
CreatedAt time.Time `db:"created_at"`
}
I create a slice of structs.
data := []DataKey{}
After doing a sql query and filling the slices I try to pass to mustache to build my list.
mustache.RenderFileInLayout("templates/datakeys.html.mustache", "templates/layout.html.mustache", user, data)))
datakeys.html.mustache
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>UserID</th>
<th>DataKey</th>
<th>CreatedAt</th>
</tr>
</thead>
{{#DataKey}}
<tr>
<td>{{Id}}</td>
<td>{{UserId}}</td>
<td>{{Data}}</td>
<td>{{CreatedAt}}</td>
</tr>
{{/DataKey}}
</table>
The only thing I get is the table header. This function does not return an error so I don't know why it didn't like the data. I have also tried passing it in as a reference.