func (c Core) Create(ctx context.Context, np NewProduct, now time.Time) (Product, error) {
	if err := validate.Check(np); err != nil {
		return Product{}, fmt.Errorf("validating data: %w", err)
	}
	dbPrd := db.Product{
		ID:          validate.GenerateID(),
		Name:        np.Name,
		Cost:        np.Cost,
		Quantity:    np.Quantity,
		UserID:      np.UserID,
		DateCreated: now,
		DateUpdated: now,
	}
	if err := c.store.Create(ctx, dbPrd); err != nil {
		return Product{}, fmt.Errorf("create: %w", err)
	}
	return toProduct(dbPrd), nil
}
Create adds a Product to the database. It returns the created Product with
fields like ID and DateCreated populated.
package product
import (
	"context"
	"errors"
	"fmt"
	"time"
	"github.com/ardanlabs/service/business/core/product/db"
	"github.com/ardanlabs/service/business/sys/database"
	"github.com/ardanlabs/service/business/sys/validate"
	"github.com/jmoiron/sqlx"
	"go.uber.org/zap"
)
var (
	ErrNotFound  = errors.New("product not found")
	ErrInvalidID = errors.New("ID is not in its proper form")
)
type Core struct {
	store db.Store
}
func NewCore(log *zap.SugaredLogger, sqlxDB *sqlx.DB) Core {
	return Core{
		store: db.NewStore(log, sqlxDB),
	}
}