ValidationRule
An EUDCC ValidationRule
-
The predicate typealias
Declaration
Swift
public typealias Predicate = (EUDCC) -> Bool
-
The CompareAgainst enumeration
See moreDeclaration
Swift
enum CompareAgainst<Value>
-
Compare value of a given KeyPath to another value using an operator
Declaration
Swift
static func compare<Value>( value: CompareAgainst<Value>, to compareAgainstValue: CompareAgainst<Value>, operator: @escaping (Value, Value) -> Bool, tag: Tag = .init() ) -> SelfParameters
keyPathThe KeyPath to the value of the EUDCC
compareAgainstValueThe value to compare against
operatorThe operator used for comparison
tagThe Tag. Default value
.init()Return Value
A ValidationRule
-
The CompareAgainstDate Parameter
See moreDeclaration
Swift
struct CompareAgainstDate -
Compare two Dates using a given operator
Declaration
Swift
static func compare( lhsDate: CompareAgainstDate, rhsDate: CompareAgainstDate, operator: @escaping (Date, Date) -> Bool, using calendar: Calendar = .current, tag: Tag = .init() ) -> SelfParameters
lhsDateThe left-hand-side CompareAgainstDate
rhsDateThe right-hand-side CompareAgainstDate
operatorThe operator closure
calendarThe Calendar. Default value
.currenttagThe Tag. Default value
.init()
-
Returns a ValidationRule where two given ValidationRules results will be compared to equality
Declaration
Swift
static func == ( lhs: Self, rhs: Self ) -> SelfParameters
lhsThe left-hand side of the operation
rhsThe right-hand side of the operation
-
Returns a ValidationRule where two given ValidationRule results will be compared to unequality
Declaration
Swift
static func != ( lhs: Self, rhs: Self ) -> SelfParameters
lhsThe left-hand side of the operation
rhsThe right-hand side of the operation
-
Constant ValidationRule that will always return the given Bool result value
Declaration
Swift
static func constant( _ result: Bool ) -> SelfParameters
resultThe Bool resul value
-
Has vaccination content ValidationRule
Declaration
Swift
static var isVaccination: `Self` { get } -
Has test content ValidationRule
Declaration
Swift
static var isTest: `Self` { get } -
Has recover content ValidationRule
Declaration
Swift
static var isRecovery: `Self` { get }
-
Has received all vaccination doses
Declaration
Swift
static var isVaccinationComplete: `Self` { get } -
Vaccination can be considered as fully immunized
Declaration
Swift
static func isFullyImmunized( minimumDaysPast: Int = 15, using calendar: Calendar = .current ) -> SelfParameters
minimumDaysPastThe amount of minimum days past since the last vaccination. Default value
15calendarThe Calendar that should be used. Default value
.current -
Validates if the vaccination expired by comparing if the current Date is greater than the date of vaccination added by the
maximumDaysSinceVaccinationDateDeclaration
Swift
static func isVaccinationExpired( maximumDaysSinceVaccinationDate: Int = 365, using calendar: Calendar = .current ) -> SelfParameters
maximumDaysSinceVaccinationDateThe maximum days since date of vaccination. Default value
365calendarThe Calendar. Default value
.current -
Validates if EUDCC contains a Vaccination and the
VaccineMedicinalProductvalue is contained in theWellKnownValueenumerationDeclaration
Swift
static var isWellKnownVaccineMedicinalProduct: `Self` { get } -
Validates if the
VaccineMedicinalProductis contained in the given Sequence of VaccineMedicinalProduct WellKnownValuesDeclaration
Swift
static func vaccineMedicinalProductIsOneOf<Vaccines: Sequence>( _ validVaccineMedicinalProducts: Vaccines ) -> Self where Vaccines.Element == EUDCC.Vaccination.VaccineMedicinalProduct.WellKnownValueParameters
validVaccineMedicinalProductsThe VaccineMedicinalProduct WellKnownValue Sequence
-
TestResult of Test is positive
Declaration
Swift
static var isTestedPositive: `Self` { get } -
TestResult of Test is negative
Declaration
Swift
static var isTestedNegative: `Self` { get } -
Is Test valid
Declaration
Parameters
maximumHoursPastThe maximum hours past since date of sample collection. Default value
PCR: 72 | RAPID: 48calendarThe Calendar that should be used. Default value
.current
-
Is Recovery valid
Declaration
Swift
static var isRecoveryValid: `Self` { get }
-
Conditionally execute a ValidationRule
Declaration
Swift
static func `if`( _ condition: Self, then: Self, else: Self ) -> SelfParameters
conditionThe ValidationRule that will be evaluated
thenThe then ValidationRule
elseThe optional ValidationRule
-
Performs a logical
NOT(!) operation on a ValidationRuleDeclaration
Swift
static prefix func ! ( rule: EUDCC.ValidationRule ) -> SelfParameters
ruleThe ValidationRule to negate
-
Performs a logical
AND(&&) operation on two ValidationRulesDeclaration
Swift
static func && ( lhs: Self, rhs: Self ) -> SelfParameters
lhsThe left-hand side of the operation
rhsThe right-hand side of the operation
-
Performs a logical
OR(||) operation on two ValidationRulesDeclaration
Swift
static func || ( lhs: Self, rhs: Self ) -> SelfParameters
lhsThe left-hand side of the operation
rhsThe right-hand side of the operation
-
An EUDCC ValidationRule Tag
See moreDeclaration
Swift
struct Tag : Codable, Hashableextension EUDCC.ValidationRule.Tag: CustomStringConvertibleextension EUDCC.ValidationRule.Tag: ExpressibleByStringInterpolation
-
The default
EUDCC.ValidationRuleDeclaration
Swift
static var `default`: `Self` { get }
-
Returns a Boolean value indicating whether two values are equal.
Declaration
Swift
public static func == ( lhs: Self, rhs: Self ) -> BoolParameters
lhsA value to compare.
rhsAnother value to compare.
-
Hashes the essential components of this value by feeding them into the given hasher.
Declaration
Swift
public func hash( into hasher: inout Hasher )Parameters
hasherThe hasher to use when combining the components of this instance.
ValidationRule Structure Reference