Go · 6824 bytes Raw Blame History
1 // Code generated by sqlc. DO NOT EDIT.
2 // versions:
3 // sqlc v1.31.1
4 // source: workflow_steps.sql
5
6 package actionsdb
7
8 import (
9 "context"
10
11 "github.com/jackc/pgx/v5/pgtype"
12 )
13
14 const getFirstStepForJob = `-- name: GetFirstStepForJob :one
15 SELECT id, job_id, step_index, step_id, step_name, if_expr,
16 run_command, uses_alias, working_directory, step_env,
17 continue_on_error, status, conclusion, log_object_key,
18 log_byte_count, started_at, completed_at, version,
19 created_at, updated_at, step_with
20 FROM workflow_steps
21 WHERE job_id = $1
22 ORDER BY step_index ASC
23 LIMIT 1
24 `
25
26 func (q *Queries) GetFirstStepForJob(ctx context.Context, db DBTX, jobID int64) (WorkflowStep, error) {
27 row := db.QueryRow(ctx, getFirstStepForJob, jobID)
28 var i WorkflowStep
29 err := row.Scan(
30 &i.ID,
31 &i.JobID,
32 &i.StepIndex,
33 &i.StepID,
34 &i.StepName,
35 &i.IfExpr,
36 &i.RunCommand,
37 &i.UsesAlias,
38 &i.WorkingDirectory,
39 &i.StepEnv,
40 &i.ContinueOnError,
41 &i.Status,
42 &i.Conclusion,
43 &i.LogObjectKey,
44 &i.LogByteCount,
45 &i.StartedAt,
46 &i.CompletedAt,
47 &i.Version,
48 &i.CreatedAt,
49 &i.UpdatedAt,
50 &i.StepWith,
51 )
52 return i, err
53 }
54
55 const getWorkflowStepByID = `-- name: GetWorkflowStepByID :one
56 SELECT id, job_id, step_index, step_id, step_name, if_expr,
57 run_command, uses_alias, working_directory, step_env,
58 continue_on_error, status, conclusion, log_object_key,
59 log_byte_count, started_at, completed_at, version,
60 created_at, updated_at, step_with
61 FROM workflow_steps
62 WHERE id = $1
63 `
64
65 func (q *Queries) GetWorkflowStepByID(ctx context.Context, db DBTX, id int64) (WorkflowStep, error) {
66 row := db.QueryRow(ctx, getWorkflowStepByID, id)
67 var i WorkflowStep
68 err := row.Scan(
69 &i.ID,
70 &i.JobID,
71 &i.StepIndex,
72 &i.StepID,
73 &i.StepName,
74 &i.IfExpr,
75 &i.RunCommand,
76 &i.UsesAlias,
77 &i.WorkingDirectory,
78 &i.StepEnv,
79 &i.ContinueOnError,
80 &i.Status,
81 &i.Conclusion,
82 &i.LogObjectKey,
83 &i.LogByteCount,
84 &i.StartedAt,
85 &i.CompletedAt,
86 &i.Version,
87 &i.CreatedAt,
88 &i.UpdatedAt,
89 &i.StepWith,
90 )
91 return i, err
92 }
93
94 const insertWorkflowStep = `-- name: InsertWorkflowStep :one
95
96 INSERT INTO workflow_steps (
97 job_id, step_index, step_id, step_name, if_expr,
98 run_command, uses_alias, working_directory, step_env, continue_on_error,
99 step_with
100 ) VALUES (
101 $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11
102 )
103 RETURNING id, job_id, step_index, step_id, step_name, if_expr,
104 run_command, uses_alias, working_directory, step_env,
105 continue_on_error, status, conclusion, log_object_key,
106 log_byte_count, started_at, completed_at, version,
107 created_at, updated_at, step_with
108 `
109
110 type InsertWorkflowStepParams struct {
111 JobID int64
112 StepIndex int32
113 StepID string
114 StepName string
115 IfExpr string
116 RunCommand string
117 UsesAlias string
118 WorkingDirectory string
119 StepEnv []byte
120 ContinueOnError bool
121 StepWith []byte
122 }
123
124 // SPDX-License-Identifier: AGPL-3.0-or-later
125 func (q *Queries) InsertWorkflowStep(ctx context.Context, db DBTX, arg InsertWorkflowStepParams) (WorkflowStep, error) {
126 row := db.QueryRow(ctx, insertWorkflowStep,
127 arg.JobID,
128 arg.StepIndex,
129 arg.StepID,
130 arg.StepName,
131 arg.IfExpr,
132 arg.RunCommand,
133 arg.UsesAlias,
134 arg.WorkingDirectory,
135 arg.StepEnv,
136 arg.ContinueOnError,
137 arg.StepWith,
138 )
139 var i WorkflowStep
140 err := row.Scan(
141 &i.ID,
142 &i.JobID,
143 &i.StepIndex,
144 &i.StepID,
145 &i.StepName,
146 &i.IfExpr,
147 &i.RunCommand,
148 &i.UsesAlias,
149 &i.WorkingDirectory,
150 &i.StepEnv,
151 &i.ContinueOnError,
152 &i.Status,
153 &i.Conclusion,
154 &i.LogObjectKey,
155 &i.LogByteCount,
156 &i.StartedAt,
157 &i.CompletedAt,
158 &i.Version,
159 &i.CreatedAt,
160 &i.UpdatedAt,
161 &i.StepWith,
162 )
163 return i, err
164 }
165
166 const listRunnerStepsForJob = `-- name: ListRunnerStepsForJob :many
167 SELECT id, job_id, step_index, step_id, step_name, if_expr,
168 run_command, uses_alias, working_directory, step_env,
169 continue_on_error, status, conclusion, log_byte_count,
170 started_at, completed_at, created_at, step_with
171 FROM workflow_steps
172 WHERE job_id = $1
173 ORDER BY step_index ASC
174 `
175
176 type ListRunnerStepsForJobRow struct {
177 ID int64
178 JobID int64
179 StepIndex int32
180 StepID string
181 StepName string
182 IfExpr string
183 RunCommand string
184 UsesAlias string
185 WorkingDirectory string
186 StepEnv []byte
187 ContinueOnError bool
188 Status WorkflowStepStatus
189 Conclusion NullCheckConclusion
190 LogByteCount int64
191 StartedAt pgtype.Timestamptz
192 CompletedAt pgtype.Timestamptz
193 CreatedAt pgtype.Timestamptz
194 StepWith []byte
195 }
196
197 func (q *Queries) ListRunnerStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]ListRunnerStepsForJobRow, error) {
198 rows, err := db.Query(ctx, listRunnerStepsForJob, jobID)
199 if err != nil {
200 return nil, err
201 }
202 defer rows.Close()
203 items := []ListRunnerStepsForJobRow{}
204 for rows.Next() {
205 var i ListRunnerStepsForJobRow
206 if err := rows.Scan(
207 &i.ID,
208 &i.JobID,
209 &i.StepIndex,
210 &i.StepID,
211 &i.StepName,
212 &i.IfExpr,
213 &i.RunCommand,
214 &i.UsesAlias,
215 &i.WorkingDirectory,
216 &i.StepEnv,
217 &i.ContinueOnError,
218 &i.Status,
219 &i.Conclusion,
220 &i.LogByteCount,
221 &i.StartedAt,
222 &i.CompletedAt,
223 &i.CreatedAt,
224 &i.StepWith,
225 ); err != nil {
226 return nil, err
227 }
228 items = append(items, i)
229 }
230 if err := rows.Err(); err != nil {
231 return nil, err
232 }
233 return items, nil
234 }
235
236 const listStepsForJob = `-- name: ListStepsForJob :many
237 SELECT id, job_id, step_index, step_id, step_name, run_command,
238 uses_alias, status, conclusion, log_byte_count,
239 started_at, completed_at, created_at
240 FROM workflow_steps
241 WHERE job_id = $1
242 ORDER BY step_index ASC
243 `
244
245 type ListStepsForJobRow struct {
246 ID int64
247 JobID int64
248 StepIndex int32
249 StepID string
250 StepName string
251 RunCommand string
252 UsesAlias string
253 Status WorkflowStepStatus
254 Conclusion NullCheckConclusion
255 LogByteCount int64
256 StartedAt pgtype.Timestamptz
257 CompletedAt pgtype.Timestamptz
258 CreatedAt pgtype.Timestamptz
259 }
260
261 func (q *Queries) ListStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]ListStepsForJobRow, error) {
262 rows, err := db.Query(ctx, listStepsForJob, jobID)
263 if err != nil {
264 return nil, err
265 }
266 defer rows.Close()
267 items := []ListStepsForJobRow{}
268 for rows.Next() {
269 var i ListStepsForJobRow
270 if err := rows.Scan(
271 &i.ID,
272 &i.JobID,
273 &i.StepIndex,
274 &i.StepID,
275 &i.StepName,
276 &i.RunCommand,
277 &i.UsesAlias,
278 &i.Status,
279 &i.Conclusion,
280 &i.LogByteCount,
281 &i.StartedAt,
282 &i.CompletedAt,
283 &i.CreatedAt,
284 ); err != nil {
285 return nil, err
286 }
287 items = append(items, i)
288 }
289 if err := rows.Err(); err != nil {
290 return nil, err
291 }
292 return items, nil
293 }
294