Add save function to pings
Build and copy to prod / build-and-copy (push) Successful in 32s
Details
Build and copy to prod / build-and-copy (push) Successful in 32s
Details
This commit is contained in:
parent
6d0f27eba7
commit
2561f492f9
|
@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS ping (
|
|||
);`
|
||||
|
||||
const seedStatusQuery = `INSERT INTO statuses (id, name) VALUES (?, ?)
|
||||
ON CONFLICT (id) DO NOTHING`
|
||||
ON CONFLICT (id) DO NOTHING;`
|
||||
|
||||
func CreateTable(db *sql.DB) {
|
||||
if _, err := db.Exec(createQuery); err != nil {
|
||||
|
@ -53,6 +53,8 @@ func seedStatuses(db *sql.DB) {
|
|||
}
|
||||
}
|
||||
|
||||
func (p *Ping) Save(db *sql.DB) {
|
||||
const saveQuery = `INSERT INTO ping (site, status) VALUES (?, ?);`
|
||||
|
||||
func (p *Ping) Save(db *sql.DB) {
|
||||
db.Exec(saveQuery, p.Site.Url, p.Status)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue