MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / groupedExternalTransactionsQuery

Function groupedExternalTransactionsQuery

database/reconciliation.go:802–863  ·  view source on GitHub ↗
(groupCriteria string)

Source from the content-addressed store, hash-verified

800}
801
802func groupedExternalTransactionsQuery(groupCriteria string) (string, bool) {
803 switch groupCriteria {
804 case "id":
805 return `
806 SELECT id::text AS group_key, id, amount, reference, currency, description, date, source
807 FROM ledgerforge.external_transactions
808 WHERE upload_id = $1 AND id::text IS NOT NULL AND id::text != ''
809 ORDER BY id::text
810 LIMIT $2 OFFSET $3
811 `, true
812 case "amount":
813 return `
814 SELECT amount::text AS group_key, id, amount, reference, currency, description, date, source
815 FROM ledgerforge.external_transactions
816 WHERE upload_id = $1 AND amount::text IS NOT NULL AND amount::text != ''
817 ORDER BY amount::text
818 LIMIT $2 OFFSET $3
819 `, true
820 case "reference":
821 return `
822 SELECT reference::text AS group_key, id, amount, reference, currency, description, date, source
823 FROM ledgerforge.external_transactions
824 WHERE upload_id = $1 AND reference::text IS NOT NULL AND reference::text != ''
825 ORDER BY reference::text
826 LIMIT $2 OFFSET $3
827 `, true
828 case "currency":
829 return `
830 SELECT currency::text AS group_key, id, amount, reference, currency, description, date, source
831 FROM ledgerforge.external_transactions
832 WHERE upload_id = $1 AND currency::text IS NOT NULL AND currency::text != ''
833 ORDER BY currency::text
834 LIMIT $2 OFFSET $3
835 `, true
836 case "description":
837 return `
838 SELECT description::text AS group_key, id, amount, reference, currency, description, date, source
839 FROM ledgerforge.external_transactions
840 WHERE upload_id = $1 AND description::text IS NOT NULL AND description::text != ''
841 ORDER BY description::text
842 LIMIT $2 OFFSET $3
843 `, true
844 case "date":
845 return `
846 SELECT date::text AS group_key, id, amount, reference, currency, description, date, source
847 FROM ledgerforge.external_transactions
848 WHERE upload_id = $1 AND date::text IS NOT NULL AND date::text != ''
849 ORDER BY date::text
850 LIMIT $2 OFFSET $3
851 `, true
852 case "source":
853 return `
854 SELECT source::text AS group_key, id, amount, reference, currency, description, date, source
855 FROM ledgerforge.external_transactions
856 WHERE upload_id = $1 AND source::text IS NOT NULL AND source::text != ''
857 ORDER BY source::text
858 LIMIT $2 OFFSET $3
859 `, true

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected