mysql

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomerModel

type CustomerModel struct {
	DB *sql.DB
}

CustomerModel wraps a connection pool

func (*CustomerModel) Authenticate

func (m *CustomerModel) Authenticate(email, password string) (int, error)

Authenticate verifies the credentials and returns userid if valid details are provided.

func (*CustomerModel) Get

func (m *CustomerModel) Get(id int) (*models.Customer, error)

Get fetches the details of the customer using its id

func (*CustomerModel) Insert

func (m *CustomerModel) Insert(name, address, email, password, phone string, pincode int) error

Insert creates a new customer by inserting values into the database. Returns an error

type DeliveryModel

type DeliveryModel struct {
	DB *sql.DB
}

DeliveryModel wraps a connection pool

func (*DeliveryModel) Get

func (m *DeliveryModel) Get(deliveryID int) (*models.Delivery, error)

Get fetches a delivery

func (*DeliveryModel) GetAllByCustomerID

func (m *DeliveryModel) GetAllByCustomerID(customerID int) ([]*models.Delivery, error)

GetAllByCustomerID fetches all deliveries associated with a customer id

func (*DeliveryModel) GetAllByCustomerIDStatus

func (m *DeliveryModel) GetAllByCustomerIDStatus(customerID int, status string) ([]*models.Delivery, error)

GetAllByCustomerIDStatus fetches all deliveries associated with a customer id having a particular status

func (*DeliveryModel) GetAllByVendorID

func (m *DeliveryModel) GetAllByVendorID(vendorID int) ([]*models.Delivery, error)

GetAllByVendorID fetches all deliveries associated with a vendor id

func (*DeliveryModel) GetAllByVendorIDStatus

func (m *DeliveryModel) GetAllByVendorIDStatus(vendorID int, status string) ([]*models.Delivery, error)

GetAllByVendorIDStatus fetches all deliveries associated with a vendor id having a particular status

func (*DeliveryModel) Insert

func (m *DeliveryModel) Insert(customerID, vendorID int, placementTime time.Time, dropLat, dropLong float64) (int, error)

Insert inserts a value into the table

type ListingModel

type ListingModel struct {
	DB *sql.DB
}

ListingModel wraps a connection pool

func (*ListingModel) All

func (m *ListingModel) All(vendorID int) ([]*models.Listing, error)

All gets all listing for a particular vendor

func (*ListingModel) Get

func (m *ListingModel) Get(id int) (*models.Listing, error)

Get fetches a listing item

func (*ListingModel) Insert

func (m *ListingModel) Insert(vendorID, price int, description, name string) error

Insert inserts a new listing into the database

type OrderModel

type OrderModel struct {
	DB *sql.DB
}

OrderModel wraps a connection pool

func (*OrderModel) AllFromDeliveryID

func (m *OrderModel) AllFromDeliveryID(deliveryID int) ([]*models.Order, error)

AllFromDeliveryID fetches all orders corresponding to a particular delivery ID

func (*OrderModel) Get

func (m *OrderModel) Get(orderID int) (*models.Order, error)

Get fetches a particular order using order_id

func (*OrderModel) Insert

func (m *OrderModel) Insert(deliveryID, listingID, orderQuantity, orderAmount int) error

Insert inserts a new listing into the database using delivery id

type VendorModel

type VendorModel struct {
	DB *sql.DB
}

VendorModel wraps a connection pool

func (*VendorModel) Authenticate

func (m *VendorModel) Authenticate(email, password string) (int, error)

Authenticate verifies the credentials and returns vendorid if valid details are provided.

func (*VendorModel) Get

func (m *VendorModel) Get(id int) (*models.Vendor, error)

Get fetches the details of the vendor using its id

func (*VendorModel) GetByPincode

func (m *VendorModel) GetByPincode(pincode, pincodeRange int) ([]*models.Vendor, error)

GetByPincode returns a slice of all vendors in a pincode within the specified range

func (*VendorModel) Insert

func (m *VendorModel) Insert(name, address, email, password, phone string, pincode int, gpsLat, gpsLong float64) error

Insert creates a new vendor by inserting values into the database. Returns an error

Jump to

Keyboard shortcuts

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