1
0
Fork 0
empact/db/contrib.go

30 lines
488 B
Go
Raw Normal View History

2015-03-04 19:09:08 +00:00
package db
import (
"github.com/fatih/structs"
)
type (
Contrib struct {
Week int64
Author string
Owner string
Repo string
Commits int
Additions int
Deletions int
}
)
const (
2015-03-04 20:51:17 +00:00
saveContribQuery = "" +
2015-03-04 19:09:08 +00:00
"replace into contributions (week, author, owner, repo, commits, additions, deletions) " +
"values (?, ?, ?, ?, ?, ?, ?)"
)
2015-03-04 20:51:17 +00:00
func (c *Contrib) Save() {
if _, err := stmt(saveContribQuery).Exec(structs.Values(c)); err != nil {
2015-03-04 19:09:08 +00:00
panic(err)
}
}