Advertisement
ATrogolo

TimePeriodPreciseOp

Oct 14th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export const timePeriodPreciseOp: OperatorData = {
  2.   id: TIMEPERIODPRECISE,
  3.   cptn: "between",
  4.   caseIns: true,
  5.   isRange: true,
  6.   fmt: "{expr1} [[between]] {expr2} and {expr3}",
  7.   pcnt: 3,
  8.   editor: "_DPTE",
  9.   operands: [
  10.     {
  11.       dtype: 0,
  12.       kind: 0,
  13.       val: "${HourStart}"
  14.     },
  15.     {
  16.       dtype: 0,
  17.       kind: 0,
  18.       val: "${Now}"
  19.     }
  20.   ]
  21. };
  22.  
  23.  
  24. /* some other code */
  25.  
  26. export const getAttrOperators = (
  27.   sqlType: string,
  28.   nullable: number
  29. ): string[] => {
  30.   let operators: string[] = [];
  31.  
  32.   switch (sqlType.toLowerCase()) {
  33.     // Other data type handled ..
  34.  
  35.     case "time":
  36.       operators = [
  37.         TIMEEQUALPRECISE,
  38.         TIMENOTEQUALPRECISE,
  39.         TIMEBEFOREPRECISE,
  40.         TIMEAFTERPRECISE,
  41.         TIMEPERIODPRECISE
  42.       ];
  43.       break;
  44.   }
  45.  
  46.   if (nullable === 1) {
  47.     operators = operators.concat(ISNULL, ISNOTNULL);
  48.   }
  49.  
  50.   return operators;
  51. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement