This repository has no description
1package db
2
3type FinishedLog struct {
4 LeaseID string
5 Workflow string
6 Ref string
7 Hash string
8}
9
10func (d *DB) GetFinishedLog(workflow string) (*FinishedLog, error) {
11 var fl FinishedLog
12 err := d.QueryRow(
13 `select lease_id, workflow, ref, hash
14 from mill_artifacts
15 where workflow = ?
16 order by id desc limit 1`,
17 workflow,
18 ).Scan(&fl.LeaseID, &fl.Workflow, &fl.Ref, &fl.Hash)
19 if err != nil {
20 return nil, err
21 }
22 return &fl, nil
23}
24
25func (d *DB) SaveArtifactRef(leaseID, workflow, ref, hash string) error {
26 _, err := d.Exec(
27 `insert into mill_artifacts (lease_id, workflow, ref, hash)
28 values (?, ?, ?, ?)`,
29 leaseID, workflow, ref, hash,
30 )
31 return err
32}