comparison pkg/controllers/importqueue.go @ 2672:b997e1fd1d3d import-overview-rework

Fixed warning SQL prefix for selection.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 14 Mar 2019 17:29:36 +0100
parents 8f3facf902dd
children df2a31e8f257
comparison
equal deleted inserted replaced
2671:8f3facf902dd 2672:b997e1fd1d3d
32 "gemma.intevation.de/gemma/pkg/models" 32 "gemma.intevation.de/gemma/pkg/models"
33 ) 33 )
34 34
35 const ( 35 const (
36 warningSQLPrefix = ` 36 warningSQLPrefix = `
37 `
38 selectImportsSQL = `
39 WITH warned AS ( 37 WITH warned AS (
40 SELECT distinct(import_id) AS id 38 SELECT distinct(import_id) AS id
41 FROM import.import_logs 39 FROM import.import_logs
42 WHERE kind = 'warn'::log_type 40 WHERE kind = 'warn'::log_type
43 ) 41 )`
42 selectImportsSQL = warningSQLPrefix + `
44 SELECT 43 SELECT
45 imports.id AS id, 44 imports.id AS id,
46 state::varchar, 45 state::varchar,
47 enqueued, 46 enqueued,
48 kind, 47 kind,
51 summary IS NOT NULL AS has_summary, 50 summary IS NOT NULL AS has_summary,
52 imports.id IN (SELECT id FROM warned) AS has_warnings 51 imports.id IN (SELECT id FROM warned) AS has_warnings
53 FROM import.imports 52 FROM import.imports
54 WHERE 53 WHERE
55 ` 54 `
55 selectBeforeSQL = warningSQLPrefix + `
56 SELECT enqueued FROM import.imports
57 WHERE
58 `
59 selectAfterSQL = warningSQLPrefix + `
60 SELECT enqueued FROM import.imports
61 WHERE
62 `
56 selectImportSummaySQL = ` 63 selectImportSummaySQL = `
57 SELECT summary FROM import.imports WHERE id = $1` 64 SELECT summary FROM import.imports WHERE id = $1`
58 65
59 selectHasNoRunningImportSQL = ` 66 selectHasNoRunningImportSQL = `
60 SELECT true FROM import.imports 67 SELECT true FROM import.imports
72 deleteLogsSQL = ` 79 deleteLogsSQL = `
73 DELETE FROM import.import_logs WHERE import_id = $1` 80 DELETE FROM import.import_logs WHERE import_id = $1`
74 81
75 deleteImportSQL = ` 82 deleteImportSQL = `
76 DELETE FROM import.imports WHERE id = $1` 83 DELETE FROM import.imports WHERE id = $1`
77
78 selectBeforeSQL = `
79 SELECT enqueued FROM import.imports
80 WHERE
81 `
82
83 selectAfterSQL = `
84 SELECT enqueued FROM import.imports
85 WHERE
86 `
87 ) 84 )
88 85
89 func toInt8Array(txt string) *pgtype.Int8Array { 86 func toInt8Array(txt string) *pgtype.Int8Array {
90 parts := strings.Split(txt, ",") 87 parts := strings.Split(txt, ",")
91 var ints []int64 88 var ints []int64