func (m *GormAreaRepository) Create(ctx context.Context, u *Area) error {
	defer goa.MeasureSince([]string{"goa", "db", "area", "create"}, time.Now())

	u.ID = uuid.NewV4()

	err := m.db.Create(u).Error

	// ( name, spaceID ,path ) needs to be unique
	if gormsupport.IsUniqueViolation(err, "areas_name_space_id_path_unique") {
		return errors.NewBadParameterError("name & space_id & path", u.Name+" & "+u.SpaceID.String()+" & "+u.Path.String()).Expected("unique")
	}

	if err != nil {
		goa.LogError(ctx, "error adding Area", "error", err.Error())
		return err
	}

	return nil
}
// Create creates a new record.
Create creates a new record.
// Create creates a new record .
func (m *GormAreaRepository) Create(ctx context.Context, u *Area) error {
	defer goa.MeasureSince([]string{"goa", "db", "area", "create"}, time.Now())
	u.ID = uuid.NewV4()
	err := m.db.Create(u).Error
	if gormsupport.IsUniqueViolation(err, "areas_name_space_id_path_unique") {
		return errors.NewBadParameterError("name & space_id & path", u.Name+" & "+u.SpaceID.String()+" & "+u.Path.String()).Expected("unique")
	}
	if err != nil {
		goa.LogError(ctx, "error adding Area", "error", err.Error())
		return err
	}
	return nil
}
func ( m * GormAreaRepository ) Create ( ctx context . Context , u * Area ) error { defer goa . MeasureSince ( [ ] string { " " , " " , " " , " " } , time . Now ( ) ) u . ID = uuid . NewV4 ( ) err := m . db . Create ( u ) . Error if gormsupport . IsUniqueViolation ( err , " " ) { return errors . NewBadParameterError ( " " , u . Name + " " + u . SpaceID . String ( ) + " " + u . Path . String ( ) ) . Expected ( " " ) } if err != nil { goa . LogError ( ctx , " " , " " , err . Error ( ) ) return err } return nil }
Create creates a new record.
Create creates a new record .
// ( name, spaceID ,path ) needs to be unique