Versions in this module Expand all Collapse all v1 v1.0.1 Mar 11, 2014 v1.0.0 Mar 8, 2014 Changes in this version + const AddMealPlanSQL + const AddMealSQL + const AddMealTagSQL + const CalculateTagScoresSQL + const CountServingsSQL + const CreateSearchPatternsTableSQL + const DBDriver + const DBParams + const DeleteMealPlanSQL + const DeleteMealSQL + const DeleteMealTagsSQL + const DeleteServingSQL + const DeleteServingsOfSQL + const DeleteServingsSQL + const DropSearchPatternsTableSQL + const GetMealPlanSQL + const GetMealSQL + const GetMealTagsSQL + const GetServingSQL + const GetServingsSQL + const InsertSearchPatternSQL + const InsertServingSQL + const IsFavouriteSQL + const LatestVersion + const ListAllTagsByNameSQL + const ListAllTagsSQL + const ListMealPlansBetweenSQL + const ListMealsByNameSQL + const ListMealsSQL + const ListSuggestionsSQL + const SearchTextFunc + const SetFavouriteSQL + const UpdateMealSQL + const UpdateNotesSQL + const UpdateSearchTextSQL + var ClearTablesSQLs = []string + var CreateTablesSQLs = []string + var DBSource = "mealplanner@unix(/var/run/mysqld/mysqld.sock)/mealplanner" + var DeleteTablesSQLs = []string + var Migrations = []*Migration + func AddMeal(q Queryable, meal *mpdata.Meal) (err error) + func AddMealPlan(q Queryable, mp *mpdata.MealPlan) (err error) + func AddMealTags(q Queryable, mealID uint64, tags []string) (err error) + func AddMealWithTags(q Queryable, mt mpdata.MealWithTags) (err error) + func AddServing(q Queryable, serving *mpdata.Serving) (err error) + func AttachMealTags(q Queryable, meals []*mpdata.Meal) (mts []mpdata.MealWithTags, err error) + func AutoFillMealPlan(q Queryable, mp *mpdata.MealPlan) (err error) + func AutoFillMealPlanDay(q Queryable, mpID uint64, date time.Time) (err error) + func ClearTables(q Queryable) (err error) + func Connect() (db *sql.DB, err error) + func CountServings(q Queryable, mpID uint64) (numServings int, err error) + func CreateTables(q Queryable) (err error) + func DeleteMeal(q Queryable, mealID uint64) (err error) + func DeleteMealPlan(q Queryable, mpID uint64) (err error) + func DeleteMealTags(q Queryable, mealID uint64) (err error) + func DeleteMealWithTags(q Queryable, mealID uint64) (err error) + func DeleteServing(q Queryable, mpID uint64, date time.Time) (err error) + func DeleteServings(q Queryable, mpID uint64) (err error) + func DeleteServingsOf(q Queryable, mealID uint64) (err error) + func DeleteTables(q Queryable) (err error) + func GenerateSuggestions(q Queryable, mpID uint64, date time.Time) (suggs []*mpdata.Suggestion, err error) + func GetDatabaseVersion(q Queryable) (v uint, err error) + func GetMeal(q Queryable, mealID uint64) (meal *mpdata.Meal, err error) + func GetMealPlan(q Queryable, mpID uint64) (mp *mpdata.MealPlan, err error) + func GetMealPlanWithServings(q Queryable, mpID uint64) (mps *mpdata.MealPlanWithServings, err error) + func GetMealTags(q Queryable, mealID uint64) (tags []string, err error) + func GetMealWithTags(q Queryable, mealID uint64) (mt mpdata.MealWithTags, err error) + func GetServing(q Queryable, mpID uint64, date time.Time) (serving *mpdata.Serving, err error) + func GetServings(q Queryable, mpID uint64) (servings []*mpdata.Serving, err error) + func InitDB(debug bool, testData bool) (err error) + func InitialiseVersion(q Queryable, debug bool) (err error) + func InsertTestData(q Queryable) (err error) + func ListAllTags(q Queryable, sortByName bool) (tags []string, err error) + func ListMealPlansBetween(q Queryable, from time.Time, to time.Time) (mps []*mpdata.MealPlan, err error) + func ListMeals(q Queryable, sortByName bool) (meals []*mpdata.Meal, err error) + func ListMealsWithTags(q Queryable, sortByName bool) (mts []mpdata.MealWithTags, err error) + func Migrate(q Queryable, targetVersion uint, debug bool) (err error) + func SearchMeals(q Queryable, words []string, sortByName bool) (meals []*mpdata.Meal, err error) + func SearchMealsWithTags(q Queryable, words []string, sortByName bool) (mts []mpdata.MealWithTags, err error) + func SetDatabaseVersion(q Queryable, v uint) (err error) + func ToggleFavourite(q Queryable, mealID uint64) (isFavourite bool, err error) + func UpdateMeal(q Queryable, meal *mpdata.Meal) (err error) + func UpdateMealTags(q Queryable, mealID uint64, tags []string) (err error) + func UpdateMealWithTags(q Queryable, mt mpdata.MealWithTags) (err error) + func UpdateNotes(q Queryable, mpID uint64, notes string) (err error) + func UpdateSearchText(q Queryable, mealID uint64) (err error) + func WithConnection(f WithConnectionFunc) (err error) + func WithTransaction(db *sql.DB, f WithTransactionFunc) (err error) + type FailedCloseError struct + CloseError error + OriginalError error + What string + func (err *FailedCloseError) Error() (msg string) + type LoggingQueryable struct + Q Queryable + func (lq LoggingQueryable) Exec(query string, args ...interface{}) (result sql.Result, err error) + func (lq LoggingQueryable) Prepare(query string) (stmt *sql.Stmt, err error) + func (lq LoggingQueryable) Query(query string, args ...interface{}) (rows *sql.Rows, err error) + func (lq LoggingQueryable) QueryRow(query string, args ...interface{}) (row *sql.Row) + type Migration struct + From uint + Stmts []string + To uint + func FindMigration(from uint, maxTo uint) (m *Migration) + func (m *Migration) Apply(q Queryable) (err error) + type MigrationError struct + From uint + Message string + To uint + func (e MigrationError) Error() (msg string) + type Queryable interface + Exec func(string, ...interface{}) (sql.Result, error) + Prepare func(string) (*sql.Stmt, error) + Query func(string, ...interface{}) (*sql.Rows, error) + QueryRow func(string, ...interface{}) *sql.Row + type WithConnectionFunc func(*sql.DB) error + type WithTransactionFunc func(*sql.Tx) error