|
|
@ -156,6 +156,9 @@ const omitemptyPrefix = "__omitempty__" |
|
|
|
// validation validation information via context.Context.
|
|
|
|
// validation validation information via context.Context.
|
|
|
|
func (v Validate) ValidateMapCtx(ctx context.Context, data map[string]interface{}, rules map[string]interface{}) map[string]interface{} { |
|
|
|
func (v Validate) ValidateMapCtx(ctx context.Context, data map[string]interface{}, rules map[string]interface{}) map[string]interface{} { |
|
|
|
errs := make(map[string]interface{}) |
|
|
|
errs := make(map[string]interface{}) |
|
|
|
|
|
|
|
if len(data) == 0 { |
|
|
|
|
|
|
|
return errs |
|
|
|
|
|
|
|
} |
|
|
|
Loop: |
|
|
|
Loop: |
|
|
|
for field, rule := range rules { |
|
|
|
for field, rule := range rules { |
|
|
|
if strings.HasPrefix(field, omitemptyPrefix) == true { |
|
|
|
if strings.HasPrefix(field, omitemptyPrefix) == true { |
|
|
|