Last active
March 22, 2022 11:38
-
-
Save cp-sumi-k/f41f146c84bfb900a5c3d92318aeb074 to your computer and use it in GitHub Desktop.
https://medium.com/canopas/automation-dynamic-sitemap-generation-with-golang-api-584f6c53ea9c - jobs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jobs | |
import ( | |
"db" | |
log "github.com/sirupsen/logrus" | |
) | |
type Job struct { | |
Id int `json:"id"` | |
Title string `json:"title"` | |
Description string `json:"description"` | |
} | |
func GetJobs() (jobs []Job, err error) { | |
err = db.Select(&jobs, `SELECT id, title, description FROM jobs WHERE is_active = 1`) | |
if err != nil { | |
log.Error(err) | |
return nil, err | |
} | |
return jobs, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment