• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

snowplow / sql-runner / 15063404311

16 May 2025 07:46AM UTC coverage: 27.73% (+1.0%) from 26.721%
15063404311

push

github

jbeemster
Prepared for release

353 of 1273 relevant lines covered (27.73%)

2.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/sql_runner/scanner.go
1
// Copyright (c) 2015-2025 Snowplow Analytics Ltd. All rights reserved.
2
//
3
// This program is licensed to you under the Apache License Version 2.0,
4
// and you may not use this file except in compliance with the Apache License Version 2.0.
5
// You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
6
//
7
// Unless required by applicable law or agreed to in writing,
8
// software distributed under the Apache License Version 2.0 is distributed on an
9
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
// See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
11
package main
12

13
import (
14
        "github.com/go-pg/pg/v10/orm"
15
        "github.com/go-pg/pg/v10/types"
16
)
17

18
// Results information.
19
type Results struct {
20
        results  [][]string
21
        columns  []string
22
        elements int
23
        rows     int
24
}
25

26
var _ orm.HooklessModel = (*Results)(nil)
27

28
// Init initializes Results.
29
func (results *Results) Init() error {
×
30
        results.elements = 0
×
31
        results.rows = 0
×
32

×
33
        if s := results; len(s.results) >= 0 {
×
34
                results.results = (s.results)[:0]
×
35
        }
×
36

37
        if s := results; len(s.columns) >= 0 {
×
38
                results.columns = (s.columns)[:0]
×
39
        }
×
40
        return nil
×
41
}
42

43
// NextColumnScanner returns a ColumnScanner that is used to scan columns.
44
func (results *Results) NextColumnScanner() orm.ColumnScanner {
×
45
        return results
×
46
}
×
47

48
// AddColumnScanner adds the ColumnScanner to the model.
49
func (Results) AddColumnScanner(_ orm.ColumnScanner) error {
×
50
        return nil
×
51
}
×
52

53
// ScanColumn implements ColumnScanner interface.
54
func (results *Results) ScanColumn(col types.ColumnInfo, rd types.Reader, n int) error {
×
55
        tmp, err := rd.ReadFullTemp()
×
56
        if err != nil {
×
57
                return err
×
58
        }
×
59

60
        curRow := len(results.results) - 1
×
61

×
62
        if col.Index == 0 {
×
63
                results.results = append(results.results, []string{})
×
64
                curRow = len(results.results) - 1
×
65
                results.rows++
×
66
        }
×
67

68
        if curRow == 0 {
×
69
                results.columns = append(results.columns, col.Name)
×
70
        }
×
71

72
        results.elements++
×
73
        results.results[curRow] = append(results.results[curRow], string(tmp))
×
74
        return nil
×
75
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc