@@ -25,9 +25,9 @@ func NewDatabaseService(dsn string) (*Service, error) {
25
25
return nil , err
26
26
}
27
27
28
- db .DB . SetMaxOpenConns (50 )
29
- db .DB . SetMaxIdleConns (10 )
30
- db .DB . SetConnMaxIdleTime (0 )
28
+ db .SetMaxOpenConns (50 )
29
+ db .SetMaxIdleConns (10 )
30
+ db .SetConnMaxIdleTime (0 )
31
31
32
32
dbService := & Service {DB : db } //nolint:exhaustruct
33
33
return dbService , err
@@ -117,9 +117,9 @@ func (s *Service) RegisterCredentialsForBuilder(ctx context.Context, builderName
117
117
}
118
118
119
119
_ , err = tx .Exec (`
120
- INSERT INTO service_credential_registrations
120
+ INSERT INTO service_credential_registrations
121
121
(builder_name, service, tls_cert, ecdsa_pubkey, is_active, measurement_id)
122
- VALUES ($1, $2, $3, $4, true,
122
+ VALUES ($1, $2, $3, $4, true,
123
123
(SELECT id FROM measurements_whitelist WHERE name = $5 AND attestation_type = $6)
124
124
)
125
125
` , builderName , service , nullableTLSCert , ecdsaPubKey , measurementName , attestationType )
@@ -150,26 +150,26 @@ func (s *Service) GetActiveConfigForBuilder(ctx context.Context, builderName str
150
150
151
151
func (s * Service ) GetActiveBuildersWithServiceCredentials (ctx context.Context , network string ) ([]domain.BuilderWithServices , error ) {
152
152
rows , err := s .DB .QueryContext (ctx , `
153
- SELECT
153
+ SELECT
154
154
b.name,
155
155
b.ip_address,
156
156
b.dns_name,
157
157
scr.service,
158
158
scr.tls_cert,
159
159
scr.ecdsa_pubkey
160
- FROM
160
+ FROM
161
161
builders b
162
- LEFT JOIN
162
+ LEFT JOIN
163
163
service_credential_registrations scr ON b.name = scr.builder_name
164
- WHERE
164
+ WHERE
165
165
b.is_active = true AND (scr.is_active = true OR scr.is_active IS NULL) AND b.network = $1
166
- ORDER BY
166
+ ORDER BY
167
167
b.name, scr.service
168
168
` , network )
169
169
if err != nil {
170
170
return nil , err
171
171
}
172
- defer rows .Close ()
172
+ defer rows .Close () //nolint:errcheck
173
173
174
174
buildersMap := make (map [string ]* BuilderWithCredentials )
175
175
@@ -227,9 +227,9 @@ func (s *Service) GetActiveBuildersWithServiceCredentials(ctx context.Context, n
227
227
func (s * Service ) LogEvent (ctx context.Context , eventName , builderName , name string ) error {
228
228
// Insert new event log entry with a subquery to fetch the measurement_id
229
229
_ , err := s .DB .ExecContext (ctx , `
230
- INSERT INTO event_log
230
+ INSERT INTO event_log
231
231
(event_name, builder_name, measurement_id)
232
- VALUES ($1, $2,
232
+ VALUES ($1, $2,
233
233
(SELECT id FROM measurements_whitelist WHERE name = $3)
234
234
)
235
235
` , eventName , builderName , name )
0 commit comments