Update main.go
This commit is contained in:
parent
10ae0e7848
commit
547680593a
6
main.go
6
main.go
@ -100,7 +100,7 @@ func currentTool() (tool,error) {
|
|||||||
fmt.Println(currentweek)
|
fmt.Println(currentweek)
|
||||||
|
|
||||||
//Select current tool from database
|
//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 {
|
if err != nil {
|
||||||
slog.Error("Could not query tools_tb")
|
slog.Error("Could not query tools_tb")
|
||||||
}
|
}
|
||||||
@ -110,9 +110,10 @@ func currentTool() (tool,error) {
|
|||||||
var name string
|
var name string
|
||||||
var description string
|
var description string
|
||||||
var url string
|
var url string
|
||||||
|
var week_to_post int
|
||||||
//var currenttoolinloop tool
|
//var currenttoolinloop tool
|
||||||
|
|
||||||
rows.Scan(&id, &name, &description, &url)
|
rows.Scan(&id, &name, &description, &url, &week_to_post)
|
||||||
if name == "" {
|
if name == "" {
|
||||||
return currenttool, errors.New("Could not find tool for current week. Please update tool list.")
|
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.Name = name
|
||||||
currenttool.Description = description
|
currenttool.Description = description
|
||||||
currenttool.Url = url
|
currenttool.Url = url
|
||||||
|
currenttool.Week_to_post = week_to_post
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user