Update main.go

This commit is contained in:
Matthew Fisher 2024-09-12 18:02:53 -05:00
parent 10ae0e7848
commit 547680593a

View File

@ -100,7 +100,7 @@ func currentTool() (tool,error) {
fmt.Println(currentweek)
//Select current tool from database
rows, err := connPool.Query(context.Background(), "SELECT id,name,description,url FROM tool_tb WHERE week_to_post=$1", currentweek)
rows, err := connPool.Query(context.Background(), "SELECT id,name,description,url,week_to_post FROM tool_tb WHERE week_to_post=$1", currentweek)
if err != nil {
slog.Error("Could not query tools_tb")
}
@ -110,9 +110,10 @@ func currentTool() (tool,error) {
var name string
var description string
var url string
var week_to_post int
//var currenttoolinloop tool
rows.Scan(&id, &name, &description, &url)
rows.Scan(&id, &name, &description, &url, &week_to_post)
if name == "" {
return currenttool, errors.New("Could not find tool for current week. Please update tool list.")
}
@ -122,6 +123,7 @@ func currentTool() (tool,error) {
currenttool.Name = name
currenttool.Description = description
currenttool.Url = url
currenttool.Week_to_post = week_to_post
}