product

package
v0.0.0-...-42d6aa1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Copyright (c) 2023 Tiago Melo. All rights reserved. Use of this source code is governed by the MIT License that can be found in the LICENSE file.

Package product provides the business logic and data operations for the product catalog. It includes functions for creating, getting, updating, deleting, and listing products.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, db *store.MongoDb, newProduct *models.Product) (*models.Product, error)

Create creates a new product in the database.

func Delete

Delete deletes a product from the database by uuid.

func Get

Get retrieves a product from the database by uuid.

func List

List lists all products in the database.

func Update

func Update(ctx context.Context, db *store.MongoDb, productToUpdate *models.Product) (*models.Product, error)

Update updates a product in the database.

Types

type Cursor

type Cursor interface {
	Decode(interface{}) error
	Err() error
	Close(context.Context) error
	Next(context.Context) bool
}

Cursor is an interface that defines the methods necessary for iterating over query results in a data layer. This interface is particularly useful for simplifying unit tests by allowing the implementation of mock cursors that can be used for testing data retrieval and manipulation operations.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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