Optional
addAdd two numbers n1 and n2, return number object with value of n1 + n2. If not set, the driver will look for methods named plus and add in that order.
Optional
compareCompare two numbers n1 and n2. Return value of this function should be > 0 if n1 > n2, = 0 if n1 = n2 and < 0 if n1 < n2. If not set, the driver will look for methods named comparedTo, compareTo, cmp and compare in that order
Optional
divideDivide number n1 by n2, return number object with value of n1 / n2. If not set, the driver will look for methods named dividedBy, divide and div in that order.
Optional
multiplyMultiply numbers n1 and n2, return number object with value n1 * n2. If not set, the driver will look for methods named times, multipliedBy, multiply and mul in that order.
Optional
subtractSubtract number n2 from n1, return number object with value of n1 - n2. If not set, the driver will look for methods named minus, sub and subtract in that order.
Optional
valuesDetermine if two numbers are equal. Should return true/false. This property may be useful for equality checks during query processing which is usually faster than numeric comparison via compare. If not set, the driver will look for instance methods equals, isEqualTo and eq in that order. If not found, the driver will use compare for equality checks.
Generated using TypeDoc
Object that specifies method mappings for methods from the number library that are required by the driver. Set this as static property for mappings to static methods (properties of the constructor) and to instance property for mappings to instance methods (properties of the constructor's prototype). You may also set both of the above to provide static mappings for some methods and instance mappings for others. For any required method, one mapping is sufficient (otherwise the driver will prefer instance over static).
Unless otherwise specified, the required operations are binary (i.e. they operate on two number objects). This means that static methods take 2 parameters and instance methods have this context as the 1st number object and pass 2nd number as one parameter.
You can specify each method mapping as either string or a function. If string, the driver will use constructor's or prototype's property by that name for static or instance method respectively. You may also provide a function for either static or instance method (as long as it follows the rules for arguments and this context described in previous paragraph). This allows you to customize implementation if needed.
The following assumptions can be made about the argument types:
The above means that you only need to set mappings for methods with non-typical names that would not be found on corresponding name list or if you with to customize thier implementation. In particular, for 4 tested number libraries mentioned in DBNumberConfig, no mappings are required.