Documentation
¶
Index ¶
Constants ¶
const ( StatusDraft = "draft" StatusProcessing = "processing" StatusProcessingFailed = "processing_failed" StatusReview = "review" StatusPublished = "published" StatusRejected = "rejected" )
Status values mirror the Rails workflow.
const ( TagContextCookingMethods = "cooking_methods" TagContextCulturalInfluences = "cultural_influences" TagContextCourses = "courses" TagContextDietaryRestrictions = "dietary_restrictions" )
TagContext values mirror Rails acts_as_taggable_on contexts.
Variables ¶
var AllTagContexts = []string{ TagContextCourses, TagContextCookingMethods, TagContextCulturalInfluences, TagContextDietaryRestrictions, }
AllTagContexts in display order.
Functions ¶
func RatingGlyphsFor ¶
RatingGlyphsFor returns a "★★★★☆" string for a 1–5 value.
Types ¶
type AIClassifierRun ¶
type AIClassifierRun struct {
ID int64 `db:"id"`
RecipeID *int64 `db:"recipe_id"`
ServiceClass string `db:"service_class"`
Adapter string `db:"adapter"`
AIModel string `db:"ai_model"`
SystemPrompt string `db:"system_prompt"`
UserPrompt string `db:"user_prompt"`
RawResponse string `db:"raw_response"`
Success bool `db:"success"`
ErrorClass string `db:"error_class"`
ErrorMessage string `db:"error_message"`
StartedAt *time.Time `db:"started_at"`
CompletedAt *time.Time `db:"completed_at"`
CreatedAt time.Time `db:"created_at"`
}
AIClassifierRun is an audit record for every AI pipeline call, mirroring the Rails ai_classifier_runs table.
func (*AIClassifierRun) DurationMS ¶
func (r *AIClassifierRun) DurationMS() int64
DurationMS returns the duration in milliseconds, or -1 if not complete.
type Recipe ¶
type Recipe struct {
ID int64 `db:"id" json:"id"`
Name string `db:"name" json:"name"`
Description string `db:"description" json:"description"`
Directions string `db:"directions" json:"directions"`
PreparationTime *int `db:"preparation_time" json:"preparation_time"`
CookingTime *int `db:"cooking_time" json:"cooking_time"`
Servings *int `db:"servings" json:"servings"`
ServingUnits string `db:"serving_units" json:"serving_units"`
SourceURL string `db:"source_url" json:"source_url"`
SourceText string `db:"source_text" json:"source_text"`
Status string `db:"status" json:"status"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
IsBread bool `db:"is_bread" json:"is_bread"`
Rating *int `db:"rating" json:"rating"` // 1–5, nullable
Notes string `db:"notes" json:"notes"`
// Populated on load when needed.
Ingredients []RecipeIngredient `db:"-" json:"ingredients"`
Tags []Tag `db:"-" json:"tags"`
}
Recipe is the core domain model.
func (*Recipe) IsProcessing ¶
IsProcessing returns true when AI extraction is in flight.
func (*Recipe) IsPublished ¶
IsPublished returns true when the recipe is public.
func (*Recipe) RatingGlyphs ¶
RatingGlyphs returns a "★★★★☆" string for the rating, or "" if unrated.
func (*Recipe) TagsByContext ¶
TagsByContext returns all tags matching the given context.
func (*Recipe) TimingSummary ¶
TimingSummary returns a human-readable timing string.
type RecipeIngredient ¶
type RecipeIngredient struct {
ID int64 `db:"id" json:"id"`
RecipeID int64 `db:"recipe_id" json:"recipe_id"`
IngredientID int64 `db:"ingredient_id" json:"ingredient_id"`
Quantity string `db:"quantity" json:"quantity"`
QuantityNumeric *float64 `db:"quantity_numeric" json:"quantity_numeric"`
Unit string `db:"unit" json:"unit"`
UnitWeightG *float64 `db:"unit_weight_g" json:"unit_weight_g"`
Descriptor string `db:"descriptor" json:"descriptor"`
Section string `db:"section" json:"section"`
Position int `db:"position" json:"position"`
// Populated via JOIN when loading recipe ingredients.
IngredientName string `db:"ingredient_name" json:"ingredient_name"`
IngredientType string `db:"ingredient_type" json:"ingredient_type"`
}
RecipeIngredient is the join model between Recipe and Ingredient, carrying quantity, unit, descriptor, and section metadata.
func (*RecipeIngredient) DisplayString ¶
func (ri *RecipeIngredient) DisplayString() string
DisplayString returns a human-readable ingredient line. e.g. "1 cup flour, sifted" or "2 large eggs"