Documentation ¶
Index ¶
- Variables
- func WithDebug() func(*StorageSQLite)
- type Food
- type Journal
- type JournalMealReport
- type JournalReport
- type JournalStats
- type Meal
- type Storage
- type StorageSQLite
- func (r *StorageSQLite) Close() error
- func (r *StorageSQLite) CopyJournal(ctx context.Context, userID int64, from time.Time, mealFrom Meal, to time.Time, ...) (int, error)
- func (r *StorageSQLite) DeleteFood(ctx context.Context, key string) error
- func (r *StorageSQLite) DeleteJournal(ctx context.Context, userID int64, timestamp time.Time, meal Meal, ...) error
- func (r *StorageSQLite) DeleteJournalMeal(ctx context.Context, userID int64, timestamp time.Time, meal Meal) error
- func (r *StorageSQLite) DeleteWeight(ctx context.Context, userID int64, timestamp time.Time) error
- func (r *StorageSQLite) FindFood(ctx context.Context, pattern string) ([]Food, error)
- func (r *StorageSQLite) GetFood(ctx context.Context, key string) (*Food, error)
- func (r *StorageSQLite) GetFoodList(ctx context.Context) ([]Food, error)
- func (r *StorageSQLite) GetJournalMealReport(ctx context.Context, userID int64, timestamp time.Time, meal Meal) ([]JournalMealReport, error)
- func (r *StorageSQLite) GetJournalReport(ctx context.Context, userID int64, from, to time.Time) ([]JournalReport, error)
- func (r *StorageSQLite) GetJournalStats(ctx context.Context, userID int64, from, to time.Time) ([]JournalStats, error)
- func (r *StorageSQLite) GetUserSettings(ctx context.Context, userID int64) (*UserSettings, error)
- func (r *StorageSQLite) GetWeightList(ctx context.Context, userID int64, from, to time.Time) ([]Weight, error)
- func (r *StorageSQLite) SetFood(ctx context.Context, food *Food) error
- func (r *StorageSQLite) SetFoodComment(ctx context.Context, key, comment string) error
- func (r *StorageSQLite) SetJournal(ctx context.Context, userID int64, journal *Journal) error
- func (r *StorageSQLite) SetUserSettings(ctx context.Context, userID int64, settings *UserSettings) error
- func (r *StorageSQLite) SetWeight(ctx context.Context, userID int64, weight *Weight) error
- type TxFn
- type UserSettings
- type Weight
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Food ErrFoodNotFound = errors.New("food not found") ErrFoodInvalid = errors.New("invalid food") ErrFoodEmptyList = errors.New("empty food list") ErrFoodIsUsed = errors.New("food is used") // Journal ErrJournalInvalid = errors.New("journal invalid") ErrJournalMealReportEmpty = errors.New("empty journal meal report") ErrJournalReportEmpty = errors.New("empty journal report") ErrJournalStatsEmpty = errors.New("empty journal stats") ErrJournalInvalidFood = errors.New("journal invalid food") ErrCopyToNotEmpty = errors.New("copy destination not empty") // Weight ErrWeightNotFound = errors.New("weight not found") ErrWeightInvalid = errors.New("invalid weight") ErrWeightEmptyList = errors.New("empty weight list") // UserSettings ErrUserSettingsNotFound = errors.New("user settings not found") ErrUserSettingsInvalid = errors.New("invalid user settings") )
Functions ¶
func WithDebug ¶
func WithDebug() func(*StorageSQLite)
Types ¶
type Food ¶
type JournalMealReport ¶
type JournalReport ¶
type JournalStats ¶
type Storage ¶
type Storage interface { // // Food GetFood(ctx context.Context, key string) (*Food, error) SetFood(ctx context.Context, food *Food) error SetFoodComment(ctx context.Context, key, comment string) error GetFoodList(ctx context.Context) ([]Food, error) FindFood(ctx context.Context, pattern string) ([]Food, error) DeleteFood(ctx context.Context, key string) error // Weight GetWeightList(ctx context.Context, userID int64, from, to time.Time) ([]Weight, error) SetWeight(ctx context.Context, userID int64, weight *Weight) error DeleteWeight(ctx context.Context, userID int64, timestamp time.Time) error // Journal SetJournal(ctx context.Context, userID int64, journal *Journal) error DeleteJournal(ctx context.Context, userID int64, timestamp time.Time, meal Meal, foodkey string) error DeleteJournalMeal(ctx context.Context, userID int64, timestamp time.Time, meal Meal) error GetJournalMealReport(ctx context.Context, userID int64, timestamp time.Time, meal Meal) ([]JournalMealReport, error) GetJournalReport(ctx context.Context, userID int64, from, to time.Time) ([]JournalReport, error) GetJournalStats(ctx context.Context, userID int64, from, to time.Time) ([]JournalStats, error) CopyJournal(ctx context.Context, userID int64, from time.Time, mealFrom Meal, to time.Time, mealTo Meal) (int, error) // UserSettings GetUserSettings(ctx context.Context, userID int64) (*UserSettings, error) SetUserSettings(ctx context.Context, userID int64, settings *UserSettings) error Close() error }
type StorageSQLite ¶
type StorageSQLite struct {
// contains filtered or unexported fields
}
func NewStorageSQLite ¶
func NewStorageSQLite(dbFilePath string, opts ...func(*StorageSQLite)) (*StorageSQLite, error)
func (*StorageSQLite) Close ¶
func (r *StorageSQLite) Close() error
func (*StorageSQLite) CopyJournal ¶
func (*StorageSQLite) DeleteFood ¶
func (r *StorageSQLite) DeleteFood(ctx context.Context, key string) error
func (*StorageSQLite) DeleteJournal ¶
func (*StorageSQLite) DeleteJournalMeal ¶
func (*StorageSQLite) DeleteWeight ¶
func (*StorageSQLite) GetFoodList ¶
func (r *StorageSQLite) GetFoodList(ctx context.Context) ([]Food, error)
func (*StorageSQLite) GetJournalMealReport ¶
func (r *StorageSQLite) GetJournalMealReport(ctx context.Context, userID int64, timestamp time.Time, meal Meal) ([]JournalMealReport, error)
func (*StorageSQLite) GetJournalReport ¶
func (r *StorageSQLite) GetJournalReport(ctx context.Context, userID int64, from, to time.Time) ([]JournalReport, error)
func (*StorageSQLite) GetJournalStats ¶
func (r *StorageSQLite) GetJournalStats(ctx context.Context, userID int64, from, to time.Time) ([]JournalStats, error)
func (*StorageSQLite) GetUserSettings ¶
func (r *StorageSQLite) GetUserSettings(ctx context.Context, userID int64) (*UserSettings, error)
func (*StorageSQLite) GetWeightList ¶
func (*StorageSQLite) SetFood ¶
func (r *StorageSQLite) SetFood(ctx context.Context, food *Food) error
func (*StorageSQLite) SetFoodComment ¶
func (r *StorageSQLite) SetFoodComment(ctx context.Context, key, comment string) error
func (*StorageSQLite) SetJournal ¶
func (*StorageSQLite) SetUserSettings ¶
func (r *StorageSQLite) SetUserSettings(ctx context.Context, userID int64, settings *UserSettings) error
type UserSettings ¶
type UserSettings struct {
CalLimit float64
}
func (*UserSettings) Validate ¶
func (r *UserSettings) Validate() bool
Click to show internal directories.
Click to hide internal directories.