I am using https://entgo.io/ as entity framework and https://echo.labstack.com/ as web framework.
Consider the following code snippet:
func main() {
client, err := Open("postgresql://pgadmin:pgpw@127.0.0.1/nfeed")
if err != nil {
log.Fatal(err.Error())
return
}
ctx := context.Background()
if err := client.Schema.Create(ctx); err != nil {
log.Fatal(err)
return
}
e := echo.New()
e.GET("/hashtags", func(c echo.Context) error {
pattern := c.QueryParam("pattern")
if len(pattern) == 0 {
return c.JSON(http.StatusNotFound, err)
}
hs, err := client.Hashtag.Query().All(????)
return c.JSON(http.StatusOK, "Hello")
})
e.Logger.Fatal(e.Start(":3000"))
}
The function call client.Hashtag.Query().All(context) expects https://pkg.go.dev/context as parameter.
The question is, how or where can I get the context? In my opinion, the Echo framework should provide me a Context. Unfortunately, I could not found within the Echo module.