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

lightningnetwork / lnd / 18530447528

15 Oct 2025 01:25PM UTC coverage: 66.36%. First build
18530447528

Pull #10287

github

web-flow
Merge 069f7c628 into a0044baa8
Pull Request #10287: [Part 2|*] Implement First Part for SQL Backend functions

0 of 880 new or added lines in 4 files covered. (0.0%)

137230 of 206796 relevant lines covered (66.36%)

21221.28 hits per line

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

25.0
/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.
57
func (r GetChannelsByPolicyLastUpdateRangeRow) Channel() GraphChannel {
×
58
        return r.GraphChannel
×
59
}
×
60

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

68
// Node2 returns the second GraphNode associated with this channel.
69
//
70
// NOTE: This method is part of the ChannelAndNodes interface.
71
func (r GetChannelsByPolicyLastUpdateRangeRow) Node2() GraphNode {
×
72
        return r.GraphNode_2
×
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.
91
func (r GetChannelsBySCIDWithPoliciesRow) Channel() GraphChannel {
×
92
        return r.GraphChannel
×
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.
98
func (r GetChannelsBySCIDWithPoliciesRow) Node1Pub() []byte {
×
99
        return r.GraphNode.PubKey
×
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.
105
func (r GetChannelsBySCIDWithPoliciesRow) Node2Pub() []byte {
×
106
        return r.GraphNode_2.PubKey
×
107
}
×
108

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

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

123
// Channel returns the GraphChannel associated with this interface.
124
//
125
// NOTE: This method is part of the ChannelAndNodeIDs interface.
126
func (r GetChannelsByOutpointsRow) Channel() GraphChannel {
×
127
        return r.GraphChannel
×
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.
133
func (r GetChannelsByOutpointsRow) Node1Pub() []byte {
×
134
        return r.Node1Pubkey
×
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.
140
func (r GetChannelsByOutpointsRow) Node2Pub() []byte {
×
141
        return r.Node2Pubkey
×
142
}
×
143

144
// Channel returns the GraphChannel associated with this interface.
145
//
146
// NOTE: This method is part of the ChannelAndNodeIDs interface.
147
func (r GetChannelsBySCIDRangeRow) Channel() GraphChannel {
×
148
        return r.GraphChannel
×
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.
154
func (r GetChannelsBySCIDRangeRow) Node1Pub() []byte {
×
155
        return r.Node1PubKey
×
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.
161
func (r GetChannelsBySCIDRangeRow) Node2Pub() []byte {
×
162
        return r.Node2PubKey
×
163
}
×
164

165
// PaymentAndIntent is an interface that provides access to a payment and its
166
// associated payment intent.
167
type PaymentAndIntent interface {
168
        // GetPayment returns the Payment associated with this interface.
169
        GetPayment() Payment
170

171
        // GetPaymentIntent returns the PaymentIntent associated with this payment.
172
        GetPaymentIntent() PaymentIntent
173
}
174

175
// GetPayment returns the Payment associated with this interface.
176
//
177
// NOTE: This method is part of the PaymentAndIntent interface.
NEW
178
func (r FilterPaymentsRow) GetPayment() Payment {
×
NEW
179
        return r.Payment
×
NEW
180
}
×
181

182
// GetPaymentIntent returns the PaymentIntent associated with this payment.
183
//
184
// NOTE: This method is part of the PaymentAndIntent interface.
NEW
185
func (r FilterPaymentsRow) GetPaymentIntent() PaymentIntent {
×
NEW
186
        return r.PaymentIntent
×
NEW
187
}
×
188

189
// GetPayment returns the Payment associated with this interface.
190
//
191
// NOTE: This method is part of the PaymentAndIntent interface.
NEW
192
func (r FetchPaymentRow) GetPayment() Payment {
×
NEW
193
        return r.Payment
×
NEW
194
}
×
195

196
// GetPaymentIntent returns the PaymentIntent associated with this payment.
197
//
198
// NOTE: This method is part of the PaymentAndIntent interface.
NEW
199
func (r FetchPaymentRow) GetPaymentIntent() PaymentIntent {
×
NEW
200
        return r.PaymentIntent
×
NEW
201
}
×
202

203
// GetPayment returns the Payment associated with this interface.
204
//
205
// NOTE: This method is part of the PaymentAndIntent interface.
NEW
206
func (r FetchPaymentsByIDsRow) GetPayment() Payment {
×
NEW
207
        return r.Payment
×
NEW
208
}
×
209

210
// GetPaymentIntent returns the PaymentIntent associated with this payment.
211
//
212
// NOTE: This method is part of the PaymentAndIntent interface.
NEW
213
func (r FetchPaymentsByIDsRow) GetPaymentIntent() PaymentIntent {
×
NEW
214
        return r.PaymentIntent
×
NEW
215
}
×
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