2021-09-24 09:06:26 +00:00
|
|
|
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by the Drone Non-Commercial License
|
|
|
|
// that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// +build !oss
|
|
|
|
|
|
|
|
package card
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/drone/drone/store/shared/db"
|
|
|
|
)
|
|
|
|
|
|
|
|
// helper function converts the card structure to a set
|
|
|
|
// of named query parameters.
|
2021-10-26 07:10:01 +00:00
|
|
|
func toParams(card *card) (map[string]interface{}, error) {
|
2021-09-24 09:06:26 +00:00
|
|
|
return map[string]interface{}{
|
2021-10-26 07:10:01 +00:00
|
|
|
"card_id": card.Id,
|
|
|
|
"card_data": card.Data,
|
2021-09-24 09:06:26 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// helper function scans the sql.Row and copies the column
|
|
|
|
// values to the destination object.
|
2021-10-26 07:10:01 +00:00
|
|
|
func scanRow(scanner db.Scanner, dst *card) error {
|
2021-09-24 09:06:26 +00:00
|
|
|
err := scanner.Scan(
|
|
|
|
&dst.Id,
|
2021-10-26 07:10:01 +00:00
|
|
|
&dst.Data,
|
2021-09-24 09:06:26 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|