store

package
v0.0.0-...-cd81d71 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapProductModelToProductEntity

func MapProductModelToProductEntity(p Product) entity.Product

Types

type MongoDB

type MongoDB struct {
	Db *mongo.Client
}

func InitMongo

func InitMongo(dsn string) MongoDB

func (*MongoDB) CreateProduct

func (m *MongoDB) CreateProduct(ctx context.Context, p entity.Product) (entity.Product, error)

func (*MongoDB) GetProduct

func (m *MongoDB) GetProduct(ctx context.Context, id int64) (entity.Product, error)

type Product

type Product struct {
	ID          uuid.UUID `bson:"_id"`
	CreatedAt   time.Time `bson:"created_at"`
	UpdatedAt   time.Time `bson:"updated_at"`
	Name        string    `bson:"name"`
	Description string    `bson:"description"`
	Price       int64     `bson:"price"`
	Category    string    `bson:"category"`
	Features    []string  `bson:"features"`
}

func MapProductEntityToProductModel

func MapProductEntityToProductModel(p entity.Product) Product

Jump to

Keyboard shortcuts

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