// List retrieves a list of existing products from the database.
List retrieves a list of existing products from the database.
// List retrieves a list of existing products from the database .
func List(ctx context.Context, dbConn *db.DB) ([]Product, error) {
	ctx, span := trace.StartSpan(ctx, "internal.product.List")
	defer span.End()
	p := []Product{}
	f := func(collection *mgo.Collection) error {
		return collection.Find(nil).All(&p)
	}
	if err := dbConn.Execute(ctx, productsCollection, f); err != nil {
		return nil, errors.Wrap(err, "db.products.find()")
	}
	return p, nil
}
func List ( ctx context . Context , dbConn * db . DB ) ( [ ] Product , error ) { ctx , span := trace . StartSpan ( ctx , " " ) defer span . End ( ) p := [ ] Product { } f := func ( collection * mgo . Collection ) error { return collection . Find ( nil ) . All ( & p ) } if err := dbConn . Execute ( ctx , productsCollection , f ) ; err != nil { return nil , errors . Wrap ( err , " " ) } return p , nil }
List retrieves a list of existing products from the database.
List retrieves a list of existing products from the database .