package model type Recipe struct { Id string // FIXME has to be uint Title string Portions string // FIXME has to be uint URL string Notes string } func (d *Recipe) FromDB() error { query, err := GetSql(`recipe-select`) if err != nil { return err } return db.QueryRow(query, d.Id).Scan( &d.Id, &d.Title, &d.Portions, &d.URL, &d.Notes, ) } func (d *Recipe) ToDB() error { query, err := GetSql(`recipe-update`) if err != nil { return err } _, err = db.Exec(query, d.Title, d.Portions, d.URL, d.Notes, d.Id) return err }