Documentation ¶
Index ¶
- func AutoMigrate(_ context.Context, dbConn *sql.DB, up bool) error
- func ConnnectionString(host, user, password, dbname string, port int64) string
- type Client
- func (c *Client) AddIngredientUnit(ctx context.Context, m models.IngredientUnit) (int64, error)
- func (c *Client) AddRecipeToMeal(ctx context.Context, mealId, recipeId string, m *float64, tx *sql.Tx) error
- func (c *Client) AssociateFoodWithIngredient(ctx context.Context, ingredient string, fdcId int) error
- func (c *Client) DB() *sqlx.DB
- func (c *Client) DoesNotionImageExist(ctx context.Context, blockID string) (exists bool, err error)
- func (c *Client) GetAlbums(ctx context.Context) (models.GphotosAlbumSlice, error)
- func (c *Client) GetAllMeals(ctx context.Context) (Meals, error)
- func (c *Client) GetKV(ctx context.Context, key string) (string, error)
- func (c *Client) GetMealById(ctx context.Context, id string) (*Meal, error)
- func (c *Client) GetMealRecipes(ctx context.Context, mealID ...string) (MealRecipes, error)
- func (c *Client) GetMealsWithRecipe(ctx context.Context, recipeID string) (Meals, error)
- func (c *Client) GetNotionPhotosForMeal(ctx context.Context, meal string) (models.NotionImageSlice, error)
- func (c *Client) GetPhotos(ctx context.Context) (models.GphotosPhotoSlice, error)
- func (c *Client) GetPhotosForMeal(ctx context.Context, meal string) (models.GphotosPhotoSlice, error)
- func (c *Client) MealIDInRange(ctx context.Context, t time.Time, name string, tx *sql.Tx) (mealID string, err error)
- func (c *Client) MergeIngredients(ctx context.Context, tx *sql.Tx, ingredientID string, ids []string) error
- func (c *Client) RecipeIngredientDependencies(ctx context.Context) ([]RecipeIngredientDependency, error)
- func (c *Client) SaveImage(ctx context.Context, tx *sql.Tx, items ...*models.Image) error
- func (c *Client) SetKV(ctx context.Context, key string, json string) error
- func (c *Client) SyncMealsFromGPhotos(ctx context.Context) error
- func (c *Client) SyncNotionMealFromNotionRecipe(ctx context.Context) error
- func (c *Client) UpsertNotionImages(ctx context.Context, tx *sql.Tx, photos models.NotionImageSlice) error
- type Meal
- type MealRecipe
- type MealRecipes
- type Meals
- type NotionRecipeMeta
- type RecipeIngredientDependency
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnnectionString ¶
ConnnectionString returns a DSN.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a database client
func (*Client) AddIngredientUnit ¶
func (*Client) AddRecipeToMeal ¶
func (*Client) AssociateFoodWithIngredient ¶
func (*Client) DoesNotionImageExist ¶
func (*Client) GetMealById ¶
func (*Client) GetMealRecipes ¶
func (*Client) GetMealsWithRecipe ¶
func (*Client) GetNotionPhotosForMeal ¶
func (*Client) GetPhotosForMeal ¶
func (*Client) MealIDInRange ¶
func (*Client) MergeIngredients ¶
func (c *Client) MergeIngredients(ctx context.Context, tx *sql.Tx, ingredientID string, ids []string) error
MergeIngredients sets the provided ingredients `parent` to the first one. TODO: prevent cyclic loop?
func (*Client) RecipeIngredientDependencies ¶
func (c *Client) RecipeIngredientDependencies(ctx context.Context) ([]RecipeIngredientDependency, error)
func (*Client) SyncMealsFromGPhotos ¶
func (*Client) SyncNotionMealFromNotionRecipe ¶
func (*Client) UpsertNotionImages ¶
type MealRecipe ¶
type MealRecipes ¶
type MealRecipes []MealRecipe
func (MealRecipes) ByMealID ¶
func (r MealRecipes) ByMealID() map[string][]MealRecipe
func (MealRecipes) RecipeIDs ¶
func (r MealRecipes) RecipeIDs() []string
type NotionRecipeMeta ¶
type NotionRecipeMeta struct {
Tags []string `json:"tags"`
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.