data

package
v0.0.0-...-eca5ad7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageSizeThumbnail  = "thumbnail"
	ImageSizeSmall      = "small"
	ImageSizeMedium     = "medium"
	ImageSizeLarge      = "large"
	ImageSizeExtraLarge = "xlarge"
)
View Source
const (
	HomepageOptionWelcome   = "welcome"
	HomepageOptionRecipes   = "recipes"
	HomepageOptionFavorites = "favorites"
	HomepageOptionExplore   = "explore"
)
View Source
const (
	VisibilityPrivate = "private"
	VisibilityFriends = "friends"
	VisibilityPublic  = "public"
)
View Source
const (
	InstructionTypeNone = "none"
	InstructionTypeText = "text"
	InstructionTypeLink = "link"
)

Variables

This section is empty.

Functions

func Rollback

func Rollback(tx *sqlx.Tx, err *error)

Types

type Account

type Account struct {
	ID              uuid.UUID
	KrogerProfileID uuid.UUID
	ImageSize       string
	LocationID      *string
	Homepage        string
}

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(client *redis.Client, expiration time.Duration) *Cache

func (*Cache) RetrieveKrogerLocation

func (c *Cache) RetrieveKrogerLocation(ctx context.Context, locationID string) (*CacheLocation, error)

func (*Cache) RetrieveKrogerProduct

func (c *Cache) RetrieveKrogerProduct(ctx context.Context, productIDs ...string) ([]CacheProduct, []string, error)

func (*Cache) StoreKrogerLocation

func (c *Cache) StoreKrogerLocation(ctx context.Context, location CacheLocation) error

func (*Cache) StoreKrogerProduct

func (c *Cache) StoreKrogerProduct(ctx context.Context, products ...CacheProduct) error

type CacheLocation

type CacheLocation struct {
	LocationID string `json:"locationID"`
	Name       string `json:"name"`
	Address    string `json:"address"`
}

type CacheProduct

type CacheProduct struct {
	ProductID   string `json:"productID"`
	Brand       string `json:"brand"`
	Description string `json:"description"`
	Size        string `json:"size"`
	URL         string `json:"url"`
	Location    string `json:"location"`
}

type CartProduct

type CartProduct struct {
	AccountID uuid.UUID
	ProductID string
	Quantity  int
	Staple    bool
}

type Ingredient

type Ingredient struct {
	ProductID string    `db:"product_id"`
	ListID    uuid.UUID `db:"list_id"`
	Quantity  int       `db:"quantity"` // represents a percentage of the total product
	Staple    bool      `db:"staple"`
}

func (Ingredient) QuantityDecimalString

func (i Ingredient) QuantityDecimalString() string

type List

type List struct {
	ID          uuid.UUID `db:"id"`
	AccountID   uuid.UUID `db:"account_id"`
	Name        string    `db:"name"`
	Description string    `db:"description"`
}

type ListCartProductsFilter

type ListCartProductsFilter interface {
	// contains filtered or unexported methods
}

type ListCartProductsIncludeStaples

type ListCartProductsIncludeStaples struct {
	Include bool
}

type ListListsFilter

type ListListsFilter interface {
	// contains filtered or unexported methods
}

type ListListsFilterByName

type ListListsFilterByName struct {
	Name string
}

type ListListsOrderBy

type ListListsOrderBy struct {
	Field     string
	Direction string
}

type ListRecipesFilter

type ListRecipesFilter interface {
	// contains filtered or unexported methods
}

type ListRecipesFilterByAccountID

type ListRecipesFilterByAccountID struct {
	AccountID uuid.UUID
}

type ListRecipesFilterByFavorites

type ListRecipesFilterByFavorites struct{}

type ListRecipesFilterByName

type ListRecipesFilterByName struct {
	Name string
}

type ListRecipesFilterByVisibilities

type ListRecipesFilterByVisibilities struct {
	Visibilities []string
}

type ListRecipesOrderBy

type ListRecipesOrderBy struct {
	Field     string
	Direction string
}

type Profile

type Profile struct {
	AccountID   uuid.UUID
	DisplayName string
}

type Recipe

type Recipe struct {
	ListID          uuid.UUID `db:"list_id"`
	AccountID       uuid.UUID `db:"account_id"`
	Name            string    `db:"name"`
	Description     string    `db:"description"`
	InstructionType string    `db:"instruction_type"`
	Instructions    string    `db:"instructions"`
	Visibility      string    `db:"visibility"`
	Favorite        bool      `db:"favorite"`
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(db *sqlx.DB) *Repository

func (*Repository) AddCartProduct

func (r *Repository) AddCartProduct(ctx context.Context, accountID uuid.UUID, productID string, quantity int, staple bool) error

func (*Repository) ClearCartProducts

func (r *Repository) ClearCartProducts(ctx context.Context, accountID uuid.UUID) error

func (*Repository) CreateAccount

func (r *Repository) CreateAccount(ctx context.Context, krogerProfileID uuid.UUID) (Account, error)

func (*Repository) CreateIngredient

func (m *Repository) CreateIngredient(ctx context.Context, productID string, listID uuid.UUID, quantity int, staple bool) error

func (*Repository) CreateList

func (r *Repository) CreateList(ctx context.Context, accountID uuid.UUID, name, description string) (uuid.UUID, error)

func (*Repository) CreateProfile

func (r *Repository) CreateProfile(ctx context.Context, accountID uuid.UUID, displayName string) (Profile, error)

func (*Repository) CreateRecipe

func (r *Repository) CreateRecipe(ctx context.Context, accountID uuid.UUID, name, description, instructionType, instructions, visibility string) (listID uuid.UUID, retErr error)

func (*Repository) CreateSession

func (r *Repository) CreateSession(ctx context.Context, accountID uuid.UUID) (Session, error)

func (*Repository) DeleteAccount

func (r *Repository) DeleteAccount(ctx context.Context, id uuid.UUID) (retErr error)

func (*Repository) DeleteIngredient

func (m *Repository) DeleteIngredient(ctx context.Context, productID string, listID uuid.UUID) error

func (*Repository) DeleteList

func (r *Repository) DeleteList(ctx context.Context, id uuid.UUID) (retErr error)

func (*Repository) DeleteProfile

func (r *Repository) DeleteProfile(ctx context.Context, accountID uuid.UUID) error

func (*Repository) DeleteRecipe

func (m *Repository) DeleteRecipe(ctx context.Context, listID uuid.UUID) (retErr error)

func (*Repository) DeleteSession

func (r *Repository) DeleteSession(ctx context.Context, id uuid.UUID) error

func (*Repository) FavoriteRecipe

func (m *Repository) FavoriteRecipe(ctx context.Context, listID, accountID uuid.UUID) error

func (*Repository) GetAccountByID

func (r *Repository) GetAccountByID(ctx context.Context, id uuid.UUID) (Account, error)

func (*Repository) GetAccountByKrogerProfileID

func (r *Repository) GetAccountByKrogerProfileID(ctx context.Context, krogerProfileID uuid.UUID) (Account, error)

func (*Repository) GetCartProduct

func (r *Repository) GetCartProduct(ctx context.Context, accountID uuid.UUID, productID string) (CartProduct, error)

func (*Repository) GetIngredient

func (r *Repository) GetIngredient(ctx context.Context, listID uuid.UUID, productID string) (Ingredient, error)

func (*Repository) GetList

func (r *Repository) GetList(ctx context.Context, listID uuid.UUID) (List, error)

func (*Repository) GetProfileByAccountID

func (r *Repository) GetProfileByAccountID(ctx context.Context, accountID uuid.UUID) (*Profile, error)

func (*Repository) GetRecipe

func (r *Repository) GetRecipe(ctx context.Context, listID uuid.UUID, accountID uuid.UUID) (Recipe, error)

func (*Repository) GetSessionByID

func (r *Repository) GetSessionByID(ctx context.Context, id uuid.UUID) (Session, error)

func (*Repository) ListCartProducts

func (r *Repository) ListCartProducts(ctx context.Context, accountID uuid.UUID, filters ...ListCartProductsFilter) ([]*CartProduct, error)

func (*Repository) ListIngredients

func (m *Repository) ListIngredients(ctx context.Context, listID uuid.UUID) ([]Ingredient, error)

func (*Repository) ListLists

func (r *Repository) ListLists(ctx context.Context, accountID uuid.UUID, filters []ListListsFilter, orderBys []ListListsOrderBy) ([]List, error)

func (*Repository) ListProfiles

func (r *Repository) ListProfiles(ctx context.Context, name string) ([]Profile, error)

func (*Repository) ListRecipes

func (r *Repository) ListRecipes(ctx context.Context, accountID uuid.UUID, filters []ListRecipesFilter, orderBys []ListRecipesOrderBy) ([]Recipe, error)

func (*Repository) RemoveCartProduct

func (r *Repository) RemoveCartProduct(ctx context.Context, accountID uuid.UUID, productID string) error

func (*Repository) SetCartProduct

func (r *Repository) SetCartProduct(ctx context.Context, accountID uuid.UUID, productID string, quantity *int, staple *bool) error

func (*Repository) UnfavoriteRecipe

func (m *Repository) UnfavoriteRecipe(ctx context.Context, listID, accountID uuid.UUID) error

func (*Repository) UpdateAccountHomepage

func (r *Repository) UpdateAccountHomepage(ctx context.Context, id uuid.UUID, homepage string) error

func (*Repository) UpdateAccountImageSize

func (r *Repository) UpdateAccountImageSize(ctx context.Context, id uuid.UUID, imageSize string) error

func (*Repository) UpdateAccountLocationID

func (r *Repository) UpdateAccountLocationID(ctx context.Context, id uuid.UUID, locationID *string) error

func (*Repository) UpdateIngredient

func (m *Repository) UpdateIngredient(ctx context.Context, productID string, listID uuid.UUID, quantity int, staple bool) error

func (*Repository) UpdateList

func (r *Repository) UpdateList(ctx context.Context, list List) error

func (*Repository) UpdateProfileDisplayName

func (r *Repository) UpdateProfileDisplayName(ctx context.Context, accountID uuid.UUID, displayName string) error

func (*Repository) UpdateRecipe

func (r *Repository) UpdateRecipe(ctx context.Context, recipe Recipe) (retErr error)

type Session

type Session struct {
	ID        uuid.UUID
	AccountID uuid.UUID
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL