Repository navigation
Conversation
Or passes when the rules of any of the alternatives pass and reports the errors of the first one; Getter reads the value of a field without allocations, for the conditions of the rules.
The alternatives a|b, the conditions required_if, required_unless, required_with, required_with_all, required_without and required_without_all, dive into the elements of struct types by the tags of their type, keys and endkeys of map[string]V, gt, lt, ne, the strict and the not equal rules on fields, the new rules of strings, eq and ne of bools, gt and lt of times, omitnil, the escapes 0x2C and 0x7C.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On top of #76.
shared:Field.Or— passes when any alternative passes, reports the errors of the first one;Getterreads a field without allocations.a|b;required_if,required_unless,required_with,required_with_all,required_without,required_without_all;diveinto the elements of struct types by the tags of their type (Items[1].Title, recursive types,dive,requiredfor nil elements of[]*T, zero allocations);keys/endkeysofmap[string]V;gt/lt/ne/eqof strings, numbers, lengths, bools and times;gtfield,ltfield,eqfield,nefieldof numbers,nefieldof strings;alpha,number,numeric,hexadecimal,excludes,containsany,excludesall,startsnotwith,endsnotwith,eq_ignore_case;omitnil; the escapes0x2C,0x7C.required; the nil nested structs are skipped;gtof a time compares with now).The alternatives allocate the errors of the failed ones (documented on
Or), a value passing the first alternative doesn't allocate. 100% coverage.