database

package
v0.0.0-...-18020a0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddPaperParams

type AddPaperParams struct {
	Name              string  `json:"name"`
	CostPerSquareInch float64 `json:"costPerSquareInch"`
	Finish            string  `json:"finish"`
}

type AddPictureParams

type AddPictureParams struct {
	Name   string `json:"name"`
	UserID int64  `json:"userId"`
}

type AddPrintParams

type AddPrintParams struct {
	PictureID  int64         `json:"pictureId"`
	PaperID    int64         `json:"paperId"`
	OrderID    sql.NullInt64 `json:"orderId"`
	CartID     sql.NullInt64 `json:"cartId"`
	Width      float64       `json:"width"`
	Height     float64       `json:"height"`
	BorderSize float64       `json:"borderSize"`
	CropX      int64         `json:"cropX"`
	CropY      int64         `json:"cropY"`
	Cost       float64       `json:"cost"`
	Quantity   int64         `json:"quantity"`
}

type AddUserParams

type AddUserParams struct {
	Username string    `json:"username"`
	Email    string    `json:"email"`
	IsAdmin  bool      `json:"isAdmin"`
	Created  time.Time `json:"created"`
}

type Cart

type Cart struct {
	ID     int64 `json:"id"`
	UserID int64 `json:"userId"`
}

type CreateOrderParams

type CreateOrderParams struct {
	UserID           int64         `json:"userId"`
	ShippingDetailID sql.NullInt64 `json:"shippingDetailId"`
	Created          time.Time     `json:"created"`
	ExternalOrderID  string        `json:"externalOrderId"`
	PaymentLink      string        `json:"paymentLink"`
	IsPaid           bool          `json:"isPaid"`
	OrderStatus      string        `json:"orderStatus"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetOrderForUserParams

type GetOrderForUserParams struct {
	UserID int64 `json:"userId"`
	ID     int64 `json:"id"`
}

type GetUserCartRow

type GetUserCartRow struct {
	Cart  Cart  `json:"cart"`
	Print Print `json:"print"`
}

type Order

type Order struct {
	ID               int64         `json:"id"`
	UserID           int64         `json:"userId"`
	ShippingDetailID sql.NullInt64 `json:"shippingDetailId"`
	Created          time.Time     `json:"created"`
	ExternalOrderID  string        `json:"externalOrderId"`
	PaymentLink      string        `json:"paymentLink"`
	IsPaid           bool          `json:"isPaid"`
	OrderStatus      string        `json:"orderStatus"`
}

type Paper

type Paper struct {
	ID                int64   `json:"id"`
	Name              string  `json:"name"`
	CostPerSquareInch float64 `json:"costPerSquareInch"`
	Finish            string  `json:"finish"`
}

type Picture

type Picture struct {
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	UserID int64  `json:"userId"`
}

type Print

type Print struct {
	ID         int64         `json:"id"`
	PictureID  int64         `json:"pictureId"`
	PaperID    int64         `json:"paperId"`
	OrderID    sql.NullInt64 `json:"orderId"`
	CartID     sql.NullInt64 `json:"cartId"`
	Width      float64       `json:"width"`
	Height     float64       `json:"height"`
	BorderSize float64       `json:"borderSize"`
	CropX      int64         `json:"cropX"`
	CropY      int64         `json:"cropY"`
	Cost       float64       `json:"cost"`
	Quantity   int64         `json:"quantity"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) AddPaper

func (q *Queries) AddPaper(ctx context.Context, arg AddPaperParams) (Paper, error)

func (*Queries) AddPicture

func (q *Queries) AddPicture(ctx context.Context, arg AddPictureParams) (Picture, error)

func (*Queries) AddPrint

func (q *Queries) AddPrint(ctx context.Context, arg AddPrintParams) (Print, error)

func (*Queries) AddUser

func (q *Queries) AddUser(ctx context.Context, arg AddUserParams) (User, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) CreateOrder

func (q *Queries) CreateOrder(ctx context.Context, arg CreateOrderParams) (Order, error)

func (*Queries) DeleteOrder

func (q *Queries) DeleteOrder(ctx context.Context, id int64) error

func (*Queries) DeletePaper

func (q *Queries) DeletePaper(ctx context.Context, id int64) error

func (*Queries) DeletePicture

func (q *Queries) DeletePicture(ctx context.Context, id int64) error

func (*Queries) DeletePrint

func (q *Queries) DeletePrint(ctx context.Context, id int64) error

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, id int64) error

func (*Queries) GetCarts

func (q *Queries) GetCarts(ctx context.Context) ([]Cart, error)

func (*Queries) GetOrderForUser

func (q *Queries) GetOrderForUser(ctx context.Context, arg GetOrderForUserParams) (Order, error)

func (*Queries) GetOrdersForUser

func (q *Queries) GetOrdersForUser(ctx context.Context, userID int64) ([]Order, error)

func (*Queries) GetPapers

func (q *Queries) GetPapers(ctx context.Context) ([]Paper, error)

func (*Queries) GetPictures

func (q *Queries) GetPictures(ctx context.Context) ([]Picture, error)

func (*Queries) GetPicturesByUser

func (q *Queries) GetPicturesByUser(ctx context.Context, userID int64) ([]Picture, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, id int64) (User, error)

func (*Queries) GetUserCart

func (q *Queries) GetUserCart(ctx context.Context, userID int64) (GetUserCartRow, error)

func (*Queries) GetUsers

func (q *Queries) GetUsers(ctx context.Context) ([]User, error)

func (*Queries) UpdateOrder

func (q *Queries) UpdateOrder(ctx context.Context, arg UpdateOrderParams) error

func (*Queries) UpdateOrderStatus

func (q *Queries) UpdateOrderStatus(ctx context.Context, arg UpdateOrderStatusParams) error

func (*Queries) UpdatePaper

func (q *Queries) UpdatePaper(ctx context.Context, arg UpdatePaperParams) error

func (*Queries) UpdatePrintQuantity

func (q *Queries) UpdatePrintQuantity(ctx context.Context, arg UpdatePrintQuantityParams) error

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error

func (*Queries) UpsertCart

func (q *Queries) UpsertCart(ctx context.Context, userID int64) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type ShippingDetail

type ShippingDetail struct {
	ID                int64          `json:"id"`
	ShippingProfileID int64          `json:"shippingProfileId"`
	TrackNumber       sql.NullString `json:"trackNumber"`
}

type ShippingProfile

type ShippingProfile struct {
	ID     int64   `json:"id"`
	Name   string  `json:"name"`
	Cost   float64 `json:"cost"`
	Method string  `json:"method"`
}

type UpdateOrderParams

type UpdateOrderParams struct {
	ShippingDetailID sql.NullInt64 `json:"shippingDetailId"`
	Created          time.Time     `json:"created"`
	ExternalOrderID  string        `json:"externalOrderId"`
	PaymentLink      string        `json:"paymentLink"`
	IsPaid           bool          `json:"isPaid"`
	OrderStatus      string        `json:"orderStatus"`
	ID               int64         `json:"id"`
}

type UpdateOrderStatusParams

type UpdateOrderStatusParams struct {
	OrderStatus string `json:"orderStatus"`
	ID          int64  `json:"id"`
}

type UpdatePaperParams

type UpdatePaperParams struct {
	Name              string  `json:"name"`
	CostPerSquareInch float64 `json:"costPerSquareInch"`
	Finish            string  `json:"finish"`
	ID                int64   `json:"id"`
}

type UpdatePrintQuantityParams

type UpdatePrintQuantityParams struct {
	Quantity int64 `json:"quantity"`
	ID       int64 `json:"id"`
}

type UpdateUserParams

type UpdateUserParams struct {
	Username string    `json:"username"`
	Email    string    `json:"email"`
	IsAdmin  bool      `json:"isAdmin"`
	Created  time.Time `json:"created"`
	ID       int64     `json:"id"`
}

type User

type User struct {
	ID       int64     `json:"id"`
	Username string    `json:"username"`
	Email    string    `json:"email"`
	IsAdmin  bool      `json:"isAdmin"`
	Created  time.Time `json:"created"`
}

Jump to

Keyboard shortcuts

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