( val: number, context: Context, table: 'firstReview' | 'review' | 'note' | 'card' | undefined, column: 'created' | 'edited' | 'due', comparison: Comparison | undefined, )
| 868 | } |
| 869 | |
| 870 | function handleOneComparison( |
| 871 | val: number, |
| 872 | context: Context, |
| 873 | table: 'firstReview' | 'review' | 'note' | 'card' | undefined, |
| 874 | column: 'created' | 'edited' | 'due', |
| 875 | comparison: Comparison | undefined, |
| 876 | ) { |
| 877 | if (comparison == null) throwExp() |
| 878 | const comp = sql.raw(comparison) |
| 879 | if (table == null) { |
| 880 | const col = sql.raw(column) |
| 881 | context.parameterizeSql( |
| 882 | sql`(card.${col} ${comp} ${val} OR note.${col} ${comp} ${val})`, |
| 883 | ) |
| 884 | } else { |
| 885 | if (column === 'due') { |
| 886 | context.parameterizeSql(sql`(card.due ${comp} ${val} AND card.due >= 0)`) // negative `due`s are not timestamps, but ordinals when the card is "new" |
| 887 | } else { |
| 888 | const tbl = sql.table(table) |
| 889 | const col = sql.raw(column) |
| 890 | context.parameterizeSql(sql`${tbl}.${col} ${comp} ${val}`) |
| 891 | } |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | function getJoinTableName(context: Context) { |
| 896 | context.joinTableName++ |
no test coverage detected