repositories

package
v0.0.0-...-bd79654 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

database queries for cart operations.

payment information processing queries.

product database operations.

user database operations. (login, registration, etc.)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CartRepository

type CartRepository interface {
	FindCartByUserID(userID string) (*models.Cart, error)
	DeleteCartByUserID(userID string) error
}

type CheckoutRepository

type CheckoutRepository interface {
	SaveCheckout(checkout models.Checkout) error
}

type LogRepository

type LogRepository interface {
	LogAttack(attackType, details, ip string) error
}

type MongoCartRepository

type MongoCartRepository struct {
	Collection *mongo.Collection
}

func NewMongoCartRepository

func NewMongoCartRepository(database, collection string) *MongoCartRepository

func (*MongoCartRepository) DeleteCartByUserID

func (r *MongoCartRepository) DeleteCartByUserID(userID string) error

func (*MongoCartRepository) FindCartByUserID

func (r *MongoCartRepository) FindCartByUserID(userID string) (*models.Cart, error)

type MongoCheckoutRepo

type MongoCheckoutRepo struct {
	Collection *mongo.Collection
}

func NewMongoCheckoutRepo

func NewMongoCheckoutRepo(database, collection string) *MongoCheckoutRepo

func (*MongoCheckoutRepo) SaveCheckout

func (repo *MongoCheckoutRepo) SaveCheckout(checkout models.Checkout) error

type MongoLogRepo

type MongoLogRepo struct {
	Collection *mongo.Collection
}

func NewMongoLogRepo

func NewMongoLogRepo(database, collection string) *MongoLogRepo

func (*MongoLogRepo) LogAttack

func (repo *MongoLogRepo) LogAttack(attackType, details, ip string) error

type MongoProductRepo

type MongoProductRepo struct {
	Collection *mongo.Collection
}

func NewMongoProductRepo

func NewMongoProductRepo(database, collection string) *MongoProductRepo

func (*MongoProductRepo) AddProduct

func (repo *MongoProductRepo) AddProduct(product models.Product) error

func (*MongoProductRepo) FindProductByID

func (r *MongoProductRepo) FindProductByID(productID string) (*models.Product, error)

func (*MongoProductRepo) GetAllProducts

func (repo *MongoProductRepo) GetAllProducts() ([]models.Product, error)

func (*MongoProductRepo) SearchProducts

func (repo *MongoProductRepo) SearchProducts(keyword string) ([]models.Product, error)

type MongoUserRepo

type MongoUserRepo struct {
	Collection *mongo.Collection
}

func NewMongoUserRepo

func NewMongoUserRepo(database, collection string) *MongoUserRepo

func (*MongoUserRepo) CreateUser

func (repo *MongoUserRepo) CreateUser(user models.User) error

func (*MongoUserRepo) GetUserByUserName

func (repo *MongoUserRepo) GetUserByUserName(username string) (models.User, error)

type ProductRepository

type ProductRepository interface {
	GetAllProducts() ([]models.Product, error)
	SearchProducts(keyword string) ([]models.Product, error)
	AddProduct(product models.Product) error
	FindProductByID(productID string) (*models.Product, error)
}

type UserRepository

type UserRepository interface {
	GetUserByUserName(username string) (models.User, error)
	CreateUser(user models.User) error
}

Jump to

Keyboard shortcuts

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