func (uc *UserCreate) Save(ctx context.Context) (*User, error) {
	if uc.created_at == nil {
		v := user.DefaultCreatedAt()
		uc.created_at = &v
	}
	if uc.updated_at == nil {
		v := user.DefaultUpdatedAt()
		uc.updated_at = &v
	}
	if uc.email == nil {
		return nil, errors.New("ent: missing required field \"email\"")
	}
	if err := user.EmailValidator(*uc.email); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"email\": %v", err)
	}
	if uc.password == nil {
		return nil, errors.New("ent: missing required field \"password\"")
	}
	if err := user.PasswordValidator(*uc.password); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"password\": %v", err)
	}
	if uc.role == nil {
		v := user.DefaultRole
		uc.role = &v
	}
	if err := user.RoleValidator(*uc.role); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"role\": %v", err)
	}
	if uc.tenant == nil {
		v := user.DefaultTenant
		uc.tenant = &v
	}
	if uc.networks == nil {
		return nil, errors.New("ent: missing required field \"networks\"")
	}
	return uc.sqlSave(ctx)
}
// Save creates the User in the database.
Save creates the User in the database.
// Save creates the User in the database .
func (uc *UserCreate) Save(ctx context.Context) (*User, error) {
	if uc.created_at == nil {
		v := user.DefaultCreatedAt()
		uc.created_at = &v
	}
	if uc.updated_at == nil {
		v := user.DefaultUpdatedAt()
		uc.updated_at = &v
	}
	if uc.email == nil {
		return nil, errors.New("ent: missing required field \"email\"")
	}
	if err := user.EmailValidator(*uc.email); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"email\": %v", err)
	}
	if uc.password == nil {
		return nil, errors.New("ent: missing required field \"password\"")
	}
	if err := user.PasswordValidator(*uc.password); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"password\": %v", err)
	}
	if uc.role == nil {
		v := user.DefaultRole
		uc.role = &v
	}
	if err := user.RoleValidator(*uc.role); err != nil {
		return nil, fmt.Errorf("ent: validator failed for field \"role\": %v", err)
	}
	if uc.tenant == nil {
		v := user.DefaultTenant
		uc.tenant = &v
	}
	if uc.networks == nil {
		return nil, errors.New("ent: missing required field \"networks\"")
	}
	return uc.sqlSave(ctx)
}
func ( uc * UserCreate ) Save ( ctx context . Context ) ( * User , error ) { if uc . created_at == nil { v := user . DefaultCreatedAt ( ) uc . created_at = & v } if uc . updated_at == nil { v := user . DefaultUpdatedAt ( ) uc . updated_at = & v } if uc . email == nil { return nil , errors . New ( " \" \" " ) } if err := user . EmailValidator ( * uc . email ) ; err != nil { return nil , fmt . Errorf ( " \" \" " , err ) } if uc . password == nil { return nil , errors . New ( " \" \" " ) } if err := user . PasswordValidator ( * uc . password ) ; err != nil { return nil , fmt . Errorf ( " \" \" " , err ) } if uc . role == nil { v := user . DefaultRole uc . role = & v } if err := user . RoleValidator ( * uc . role ) ; err != nil { return nil , fmt . Errorf ( " \" \" " , err ) } if uc . tenant == nil { v := user . DefaultTenant uc . tenant = & v } if uc . networks == nil { return nil , errors . New ( " \" \" " ) } return uc . sqlSave ( ctx ) }
Save creates the User in the database.
Save creates the User in the database .