Skip to content

Instantly share code, notes, and snippets.

@cp-sumi-k
Last active March 22, 2022 11:38
Show Gist options
  • Save cp-sumi-k/f41f146c84bfb900a5c3d92318aeb074 to your computer and use it in GitHub Desktop.
Save cp-sumi-k/f41f146c84bfb900a5c3d92318aeb074 to your computer and use it in GitHub Desktop.
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