I'm trying to switch from PHP to GO, but I'm stuck at one point, I ask for your help.
I just define an alias named "durums" in the query, there is no such named field in the database. how can I send the name I defined as alias to my index template?
Vilan := []model.Vfilan{}
dSubquery := r.DB.Table("Dipfilan").
Select("(select id from iform where id = Dipfilan.id and actv='1' )as uuid ").
Where("tur = '2' AND finish > ?", time.Now())
errIlan := r.DB.Table("Vfilan").
Select("id, baslik,durumid, "+
"(SELECT title FROM idurum WHERE idurum .id = Vfilan.durumid) as durums").
Where("onay = '1' AND (id IN ? )", dSubquery).
Order("id DESC").
Find(&Vilan).
Error
if errIlan != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"message": "err" + errIlan.Error(),
})
}
return c.Render("index", fiber.Map{
"VindwIlan": Vilan,
"Vdurum": durums,
})
"Vdurum": durums, I get the error undeclared name: durums
How can I send the "durums" content to my index template.
Can you share the full error message? undeclared name: durums
Can you specify on which line you are getting this error?
return c.Render("index", fiber.Map{
"VindwIlan": Vilan,
"Vdurum": durums,
})