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

lightningnetwork / lnd / 16935388413

13 Aug 2025 11:06AM UTC coverage: 66.783%. First build
16935388413

Pull #10151

github

web-flow
Merge 3e885a47a into 4e0af2f49
Pull Request #10151: Refactor Payment PR 5 (discarded because merged into wrong branch)

384 of 781 new or added lines in 27 files covered. (49.17%)

135635 of 203098 relevant lines covered (66.78%)

21555.07 hits per line

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

32.26
/sqldb/sqlc/db_custom.go
1
package sqlc
2

3
import (
4
        "fmt"
5
        "strings"
6
)
7

8
// makeQueryParams generates a string of query parameters for a SQL query. It is
9
// meant to replace the `?` placeholders in a SQL query with numbered parameters
10
// like `$1`, `$2`, etc. This is required for the sqlc /*SLICE:<field_name>*/
11
// workaround. See scripts/gen_sqlc_docker.sh for more details.
12
func makeQueryParams(numTotalArgs, numListArgs int) string {
5✔
13
        if numListArgs == 0 {
6✔
14
                return ""
1✔
15
        }
1✔
16

17
        var b strings.Builder
4✔
18

4✔
19
        // Pre-allocate a rough estimation of the buffer size to avoid
4✔
20
        // re-allocations. A parameter like $1000, takes 6 bytes.
4✔
21
        b.Grow(numListArgs * 6)
4✔
22

4✔
23
        diff := numTotalArgs - numListArgs
4✔
24
        for i := 0; i < numListArgs; i++ {
14✔
25
                if i > 0 {
16✔
26
                        // We don't need to check the error here because the
6✔
27
                        // WriteString method of strings.Builder always returns
6✔
28
                        // nil.
6✔
29
                        _, _ = b.WriteString(",")
6✔
30
                }
6✔
31

32
                // We don't need to check the error here because the
33
                // Write method (called by fmt.Fprintf) of strings.Builder
34
                // always returns nil.
35
                _, _ = fmt.Fprintf(&b, "$%d", i+diff+1)
10✔
36
        }
37

38
        return b.String()
4✔
39
}
40

41
// ChannelAndNodes is an interface that provides access to a channel and its
42
// two nodes.
43
type ChannelAndNodes interface {
44
        // Channel returns the GraphChannel associated with this interface.
45
        Channel() GraphChannel
46

47
        // Node1 returns the first GraphNode associated with this channel.
48
        Node1() GraphNode
49

50
        // Node2 returns the second GraphNode associated with this channel.
51
        Node2() GraphNode
52
}
53

54
// Channel returns the GraphChannel associated with this interface.
55
//
56
// NOTE: This method is part of the ChannelAndNodes interface.
NEW
57
func (r GetChannelsByPolicyLastUpdateRangeRow) Channel() GraphChannel {
×
NEW
58
        return r.GraphChannel
×
NEW
59
}
×
60

61
// Node1 returns the first GraphNode associated with this channel.
62
//
63
// NOTE: This method is part of the ChannelAndNodes interface.
NEW
64
func (r GetChannelsByPolicyLastUpdateRangeRow) Node1() GraphNode {
×
NEW
65
        return r.GraphNode
×
NEW
66
}
×
67

68
// Node2 returns the second GraphNode associated with this channel.
69
//
70
// NOTE: This method is part of the ChannelAndNodes interface.
NEW
71
func (r GetChannelsByPolicyLastUpdateRangeRow) Node2() GraphNode {
×
NEW
72
        return r.GraphNode_2
×
NEW
73
}
×
74

75
// ChannelAndNodeIDs is an interface that provides access to a channel and its
76
// two node public keys.
77
type ChannelAndNodeIDs interface {
78
        // Channel returns the GraphChannel associated with this interface.
79
        Channel() GraphChannel
80

81
        // Node1Pub returns the public key of the first node as a byte slice.
82
        Node1Pub() []byte
83

84
        // Node2Pub returns the public key of the second node as a byte slice.
85
        Node2Pub() []byte
86
}
87

88
// Channel returns the GraphChannel associated with this interface.
89
//
90
// NOTE: This method is part of the ChannelAndNodeIDs interface.
NEW
91
func (r GetChannelsBySCIDWithPoliciesRow) Channel() GraphChannel {
×
NEW
92
        return r.GraphChannel
×
NEW
93
}
×
94

95
// Node1Pub returns the public key of the first node as a byte slice.
96
//
97
// NOTE: This method is part of the ChannelAndNodeIDs interface.
NEW
98
func (r GetChannelsBySCIDWithPoliciesRow) Node1Pub() []byte {
×
NEW
99
        return r.GraphNode.PubKey
×
NEW
100
}
×
101

102
// Node2Pub returns the public key of the second node as a byte slice.
103
//
104
// NOTE: This method is part of the ChannelAndNodeIDs interface.
NEW
105
func (r GetChannelsBySCIDWithPoliciesRow) Node2Pub() []byte {
×
NEW
106
        return r.GraphNode_2.PubKey
×
NEW
107
}
×
108

109
// Node1 returns the first GraphNode associated with this channel.
110
//
111
// NOTE: This method is part of the ChannelAndNodes interface.
NEW
112
func (r GetChannelsBySCIDWithPoliciesRow) Node1() GraphNode {
×
NEW
113
        return r.GraphNode
×
NEW
114
}
×
115

116
// Node2 returns the second GraphNode associated with this channel.
117
//
118
// NOTE: This method is part of the ChannelAndNodes interface.
NEW
119
func (r GetChannelsBySCIDWithPoliciesRow) Node2() GraphNode {
×
NEW
120
        return r.GraphNode_2
×
NEW
121
}
×
122

123
// Channel returns the GraphChannel associated with this interface.
124
//
125
// NOTE: This method is part of the ChannelAndNodeIDs interface.
NEW
126
func (r GetChannelsByOutpointsRow) Channel() GraphChannel {
×
NEW
127
        return r.GraphChannel
×
NEW
128
}
×
129

130
// Node1Pub returns the public key of the first node as a byte slice.
131
//
132
// NOTE: This method is part of the ChannelAndNodeIDs interface.
NEW
133
func (r GetChannelsByOutpointsRow) Node1Pub() []byte {
×
NEW
134
        return r.Node1Pubkey
×
NEW
135
}
×
136

137
// Node2Pub returns the public key of the second node as a byte slice.
138
//
139
// NOTE: This method is part of the ChannelAndNodeIDs interface.
NEW
140
func (r GetChannelsByOutpointsRow) Node2Pub() []byte {
×
NEW
141
        return r.Node2Pubkey
×
NEW
142
}
×
143

144
// Channel returns the GraphChannel associated with this interface.
145
//
146
// NOTE: This method is part of the ChannelAndNodeIDs interface.
NEW
147
func (r GetChannelsBySCIDRangeRow) Channel() GraphChannel {
×
NEW
148
        return r.GraphChannel
×
NEW
149
}
×
150

151
// Node1Pub returns the public key of the first node as a byte slice.
152
//
153
// NOTE: This method is part of the ChannelAndNodeIDs interface.
NEW
154
func (r GetChannelsBySCIDRangeRow) Node1Pub() []byte {
×
NEW
155
        return r.Node1PubKey
×
NEW
156
}
×
157

158
// Node2Pub returns the public key of the second node as a byte slice.
159
//
160
// NOTE: This method is part of the ChannelAndNodeIDs interface.
NEW
161
func (r GetChannelsBySCIDRangeRow) Node2Pub() []byte {
×
NEW
162
        return r.Node2PubKey
×
NEW
163
}
×
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

© 2025 Coveralls, Inc