Documentation ¶
Index ¶
- func NewPostgresDB(cfg Config) (*sqlx.DB, error)
- type Admin
- type AdminPg
- type Category
- type CategoryPg
- func (r *CategoryPg) Create(category *domain.Category) (int, error)
- func (r *CategoryPg) DeleteCategory(restaurantId int, categoryId int) error
- func (r *CategoryPg) GetAll(restaurantId int) ([]*domain.Category, error)
- func (r *CategoryPg) GetAllItems(categoryId int) ([]*domain.MenuItem, error)
- func (r *CategoryPg) GetById(categoryId int) (*domain.Category, error)
- func (r *CategoryPg) UpdateCategory(restaurantId int, categoryId int, input *domain.Category) error
- type Config
- type Courier
- type CourierPg
- type MenuItem
- type MenuItemPg
- func (r *MenuItemPg) Create(menuItem *domain.MenuItem, categoryId int) (int, error)
- func (r *MenuItemPg) DeleteItem(menuItemId int) error
- func (r *MenuItemPg) GetById(menuItemId int) (*domain.MenuItem, error)
- func (r *MenuItemPg) UpdateImage(menuItemId int, image string) error
- func (r *MenuItemPg) UpdateMenuItem(restaurantId int, menuItemId int, categoryId int, input *domain.MenuItem) error
- type Order
- type OrderPg
- func (r *OrderPg) Create(order *domain.Order) (int, error)
- func (r *OrderPg) CreateItem(orderItem *domain.OrderItem) (int, error)
- func (r *OrderPg) Delete(orderId int) error
- func (r *OrderPg) DeleteItem(orderId int, orderItemId int) error
- func (r *OrderPg) GetActiveCourierOrder(courierId int) (*domain.Order, error)
- func (r *OrderPg) GetActiveRestaurantOrders(restaurantId int) ([]*domain.Order, error)
- func (r *OrderPg) GetAllItems(orderId int) ([]*domain.OrderItem, error)
- func (r *OrderPg) GetById(orderId int) (*domain.Order, error)
- func (r *OrderPg) GetItemById(orderItemId int) (*domain.OrderItem, error)
- func (r *OrderPg) GetNearestCourierId(userId int) (int, error)
- func (r *OrderPg) Update(orderId int, input *domain.Order) error
- func (r *OrderPg) UpdateItem(orderItemId, menuItemsCount int) error
- type Repository
- type Restaurant
- type RestaurantPg
- func (r *RestaurantPg) Create(restaurant *domain.Restaurant) (int, error)
- func (r *RestaurantPg) GetAll(userId int) ([]*domain.Restaurant, error)
- func (r *RestaurantPg) GetByCredentials(phone, password string) (*domain.Restaurant, error)
- func (r *RestaurantPg) GetById(restaurantId int) (*domain.Restaurant, error)
- func (r *RestaurantPg) GetMenu(restarauntId int) ([]*domain.MenuItem, error)
- func (r *RestaurantPg) Update(restaurantId int, input *domain.Restaurant) error
- func (r *RestaurantPg) UpdateImage(restaurantId int, image string) error
- type User
- type UserPg
- func (r *UserPg) Create(user *domain.User) (int, error)
- func (r *UserPg) GetAllOrders(userId int, activeOrdersFlag bool) ([]*domain.Order, error)
- func (r *UserPg) GetByCredentials(phone, password string) (*domain.User, error)
- func (r *UserPg) GetById(userId int) (*domain.User, error)
- func (r *UserPg) Update(userId int, input *domain.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Category ¶
type Category interface { GetAll(restaurantId int) ([]*domain.Category, error) Create(category *domain.Category) (int, error) GetById(categoryId int) (*domain.Category, error) GetAllItems(categoryId int) ([]*domain.MenuItem, error) DeleteCategory(restaurantId int, categoryId int) error UpdateCategory(restaurantId int, categoryId int, input *domain.Category) error }
type CategoryPg ¶
type CategoryPg struct {
// contains filtered or unexported fields
}
func NewCategoryPg ¶
func NewCategoryPg(db *sqlx.DB) *CategoryPg
func (*CategoryPg) DeleteCategory ¶
func (r *CategoryPg) DeleteCategory(restaurantId int, categoryId int) error
func (*CategoryPg) GetAll ¶
func (r *CategoryPg) GetAll(restaurantId int) ([]*domain.Category, error)
func (*CategoryPg) GetAllItems ¶
func (r *CategoryPg) GetAllItems(categoryId int) ([]*domain.MenuItem, error)
func (*CategoryPg) UpdateCategory ¶
type CourierPg ¶
type CourierPg struct {
// contains filtered or unexported fields
}
func NewCourierPg ¶
func (*CourierPg) GetByCredentials ¶
type MenuItem ¶
type MenuItem interface { GetById(menuItemId int) (*domain.MenuItem, error) UpdateMenuItem(restaurantId int, menuItemId int, categoryId int, input *domain.MenuItem) error Create(menuItem *domain.MenuItem, categoryId int) (int, error) UpdateImage(menuItemId int, image string) error DeleteItem(menuItemId int) error }
type MenuItemPg ¶
type MenuItemPg struct {
// contains filtered or unexported fields
}
func NewMenuItem ¶
func NewMenuItem(db *sqlx.DB) *MenuItemPg
func (*MenuItemPg) DeleteItem ¶
func (r *MenuItemPg) DeleteItem(menuItemId int) error
func (*MenuItemPg) UpdateImage ¶
func (r *MenuItemPg) UpdateImage(menuItemId int, image string) error
func (*MenuItemPg) UpdateMenuItem ¶
type Order ¶
type Order interface { Create(order *domain.Order) (int, error) GetById(orderId int) (*domain.Order, error) Delete(orderId int) error Update(orderId int, input *domain.Order) error GetActiveRestaurantOrders(restaurantId int) ([]*domain.Order, error) CreateItem(orderItem *domain.OrderItem) (int, error) GetAllItems(orderId int) ([]*domain.OrderItem, error) GetItemById(orderItemId int) (*domain.OrderItem, error) UpdateItem(orderItemId, menuItemsCount int) error DeleteItem(orderItemId int, orderId int) error GetActiveCourierOrder(courierId int) (*domain.Order, error) GetNearestCourierId(userId int) (int, error) }
type OrderPg ¶
type OrderPg struct {
// contains filtered or unexported fields
}
func NewOrderPg ¶
func (*OrderPg) GetActiveCourierOrder ¶
func (*OrderPg) GetActiveRestaurantOrders ¶
func (*OrderPg) GetAllItems ¶
func (*OrderPg) GetItemById ¶
func (*OrderPg) GetNearestCourierId ¶
TODO: стоит вынести в репозиторий курьера
func (*OrderPg) UpdateItem ¶
type Repository ¶
func NewRepository ¶
func NewRepository(db *sqlx.DB) *Repository
type Restaurant ¶
type Restaurant interface { GetByCredentials(phone, password string) (*domain.Restaurant, error) GetAll(userId int) ([]*domain.Restaurant, error) GetById(restaurantId int) (*domain.Restaurant, error) GetMenu(restaurantId int) ([]*domain.MenuItem, error) Create(restaurant *domain.Restaurant) (int, error) UpdateImage(restaurantId int, image string) error Update(restaurantId int, input *domain.Restaurant) error }
type RestaurantPg ¶
type RestaurantPg struct {
// contains filtered or unexported fields
}
func NewRestaurantPg ¶
func NewRestaurantPg(db *sqlx.DB) *RestaurantPg
func (*RestaurantPg) Create ¶
func (r *RestaurantPg) Create(restaurant *domain.Restaurant) (int, error)
func (*RestaurantPg) GetAll ¶
func (r *RestaurantPg) GetAll(userId int) ([]*domain.Restaurant, error)
func (*RestaurantPg) GetByCredentials ¶
func (r *RestaurantPg) GetByCredentials(phone, password string) (*domain.Restaurant, error)
func (*RestaurantPg) GetById ¶
func (r *RestaurantPg) GetById(restaurantId int) (*domain.Restaurant, error)
func (*RestaurantPg) GetMenu ¶
func (r *RestaurantPg) GetMenu(restarauntId int) ([]*domain.MenuItem, error)
func (*RestaurantPg) Update ¶
func (r *RestaurantPg) Update(restaurantId int, input *domain.Restaurant) error
func (*RestaurantPg) UpdateImage ¶
func (r *RestaurantPg) UpdateImage(restaurantId int, image string) error
type UserPg ¶
type UserPg struct {
// contains filtered or unexported fields
}
func (*UserPg) GetAllOrders ¶
func (*UserPg) GetByCredentials ¶
Click to show internal directories.
Click to hide internal directories.