Пример #1
0
func (sis *SiteinfoService) saveToDB(db ab.DB, resp siteInfoResponse) error {
	_, err := db.Exec(
		"INSERT INTO siteinfo(url, blocks_iframe, has_embed_code) VALUES($1, $2, $3)",
		resp.Url,
		resp.BlocksIframe,
		resp.HasEmbedCode,
	)
	return err
}
Пример #2
0
func (e *Walkthrough) Delete(db ab.DB) error {
	res, err := db.Exec("UPDATE walkthrough SET published = false WHERE UUID = $1", e.UUID)
	if err != nil {
		return err
	}

	aff, err := res.RowsAffected()
	if err != nil {
		return err
	}

	if aff < 1 {
		return WalkthroughNotFoundError
	}

	return nil
}