2015-03-04 19:09:08 +00:00
|
|
|
package db
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/fatih/structs"
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
Repo struct {
|
|
|
|
Owner string
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2015-03-04 20:51:17 +00:00
|
|
|
saveRepoQuery = "replace into repos (owner, name, updated_at) values (?, ?, now())"
|
2015-03-04 19:09:08 +00:00
|
|
|
)
|
|
|
|
|
2015-03-04 20:51:17 +00:00
|
|
|
func (r *Repo) Save() {
|
|
|
|
if _, err := stmt(saveRepoQuery).Exec(structs.Values(r)); err != nil {
|
2015-03-04 19:09:08 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|