product.go 289 B

123456789101112131415
  1. package db
  2. import (
  3. "context"
  4. "youngee_b_api/model/gorm_model"
  5. )
  6. func CreateProduct(ctx context.Context, product gorm_model.YounggeeProduct) (*int, error) {
  7. db := GetReadDB(ctx)
  8. err := db.Create(&product).Error
  9. if err != nil {
  10. return nil, err
  11. }
  12. return &product.ProductID, nil
  13. }