moved field validation to validation package
This commit is contained in:
@@ -1,15 +1,10 @@
|
|||||||
package utils
|
package validation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"GoMembership/internal/models"
|
|
||||||
"errors"
|
"errors"
|
||||||
"reflect"
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
func HasPrivilige(user *models.User, privilige int8) bool {
|
|
||||||
return user.RoleID >= privilige
|
|
||||||
}
|
|
||||||
|
|
||||||
// FilterAllowedStructFields filters allowed fields recursively in a struct and modifies structToModify in place.
|
// FilterAllowedStructFields filters allowed fields recursively in a struct and modifies structToModify in place.
|
||||||
func FilterAllowedStructFields(input interface{}, existing interface{}, allowedFields map[string]bool, prefix string) error {
|
func FilterAllowedStructFields(input interface{}, existing interface{}, allowedFields map[string]bool, prefix string) error {
|
||||||
v := reflect.ValueOf(input)
|
v := reflect.ValueOf(input)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package utils
|
package validation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
Reference in New Issue
Block a user