order

package
v0.0.0-...-bc6e940 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package order contains the repository implementation for the order entity

Package order contains the repository implementation for the order entity

Package order contains the repository implementation for the order entity

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	Store  *sdksql.DB
	Logger *logger.Logger
}

Repository is a struct that contains the database implementation for order entity

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, newOrder *domainOrder.Request) (*domainOrder.Request, error)

Create ... Insert New data

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, id int) (err error)

Delete ... Delete order

func (*Repository) GetByID

func (r *Repository) GetByID(ctx context.Context, dinerID int64) ([]domainOrder.Response, error)

GetByID ... Fetch only one order by Id

type Request

type Request struct {
	ID        int64     `db:"id" example:"123"`
	DinnerID  int64     `db:"diner_id" example:"1"`
	MenuID    int64     `db:"menu_id" example:"3"`
	Quantity  int       `db:"quantity" example:"2"`
	CreatedAt time.Time `db:"created_at" example:"2021-02-24 20:19:39"`
}

Request is a struct that contains the order model

type Response

type Response struct {
	ID              int64     `db:"id" example:"123"`
	DinnerName      string    `db:"diner_name" example:"Mr. Smith"`
	MenuName        string    `db:"menu_name" example:"HCDB"`
	MenuDescription string    `db:"menu_description" example:"Hyderabadi Chicken Dum Briyani"`
	Quantity        int       `db:"quantity" example:"2"`
	CreatedAt       time.Time `db:"created_at" example:"2021-02-24 20:19:39"`
	UpdatedAt       time.Time `db:"updated_at" example:"2021-02-24 20:19:39"`
}

Response is a struct that contains the response order information

Jump to

Keyboard shortcuts

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