func (cc *CustomerCreate) Save(ctx context.Context) (*Customer, error) {
	if cc.create_time == nil {
		v := customer.DefaultCreateTime()
		cc.create_time = &v
	}
	if cc.update_time == nil {
		v := customer.DefaultUpdateTime()
		cc.update_time = &v
	}
	if cc.name == nil {
		return nil, errors.New("ent: missing required field \"name\"")
	}
	if err := customer.NameValidator(*cc.name); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"name\": %v", err)
	}
	if cc.external_id != nil {
		if err := customer.ExternalIDValidator(*cc.external_id); err != nil {
			return nil, fmt.Errorf("ent: validator failed for field \"external_id\": %v", err)
		}
	}
	return cc.sqlSave(ctx)
}
// Save creates the Customer in the database.
Save creates the Customer in the database.
// Save creates the Customer in the database .
func (cc *CustomerCreate) Save(ctx context.Context) (*Customer, error) {
	if cc.create_time == nil {
		v := customer.DefaultCreateTime()
		cc.create_time = &v
	}
	if cc.update_time == nil {
		v := customer.DefaultUpdateTime()
		cc.update_time = &v
	}
	if cc.name == nil {
		return nil, errors.New("ent: missing required field \"name\"")
	}
	if err := customer.NameValidator(*cc.name); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"name\": %v", err)
	}
	if cc.external_id != nil {
		if err := customer.ExternalIDValidator(*cc.external_id); err != nil {
			return nil, fmt.Errorf("ent: validator failed for field \"external_id\": %v", err)
		}
	}
	return cc.sqlSave(ctx)
}
func ( cc * CustomerCreate ) Save ( ctx context . Context ) ( * Customer , error ) { if cc . create_time == nil { v := customer . DefaultCreateTime ( ) cc . create_time = & v } if cc . update_time == nil { v := customer . DefaultUpdateTime ( ) cc . update_time = & v } if cc . name == nil { return nil , errors . New ( " \" \" " ) } if err := customer . NameValidator ( * cc . name ) ; err != nil { return nil , fmt . Errorf ( " \" \" " , err ) } if cc . external_id != nil { if err := customer . ExternalIDValidator ( * cc . external_id ) ; err != nil { return nil , fmt . Errorf ( " \" \" " , err ) } } return cc . sqlSave ( ctx ) }
Save creates the Customer in the database.
Save creates the Customer in the database .