| 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_object_key, log_byte_count, |
| 239 | started_at, completed_at, created_at, updated_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 | LogObjectKey pgtype.Text |
| 256 | LogByteCount int64 |
| 257 | StartedAt pgtype.Timestamptz |
| 258 | CompletedAt pgtype.Timestamptz |
| 259 | CreatedAt pgtype.Timestamptz |
| 260 | UpdatedAt pgtype.Timestamptz |
| 261 | } |
| 262 | |
| 263 | func (q *Queries) ListStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]ListStepsForJobRow, error) { |
| 264 | rows, err := db.Query(ctx, listStepsForJob, jobID) |
| 265 | if err != nil { |
| 266 | return nil, err |
| 267 | } |
| 268 | defer rows.Close() |
| 269 | items := []ListStepsForJobRow{} |
| 270 | for rows.Next() { |
| 271 | var i ListStepsForJobRow |
| 272 | if err := rows.Scan( |
| 273 | &i.ID, |
| 274 | &i.JobID, |
| 275 | &i.StepIndex, |
| 276 | &i.StepID, |
| 277 | &i.StepName, |
| 278 | &i.RunCommand, |
| 279 | &i.UsesAlias, |
| 280 | &i.Status, |
| 281 | &i.Conclusion, |
| 282 | &i.LogObjectKey, |
| 283 | &i.LogByteCount, |
| 284 | &i.StartedAt, |
| 285 | &i.CompletedAt, |
| 286 | &i.CreatedAt, |
| 287 | &i.UpdatedAt, |
| 288 | ); err != nil { |
| 289 | return nil, err |
| 290 | } |
| 291 | items = append(items, i) |
| 292 | } |
| 293 | if err := rows.Err(); err != nil { |
| 294 | return nil, err |
| 295 | } |
| 296 | return items, nil |
| 297 | } |
| 298 | |
| 299 | const updateWorkflowStepLogObject = `-- name: UpdateWorkflowStepLogObject :one |
| 300 | UPDATE workflow_steps |
| 301 | SET log_object_key = $1::text, |
| 302 | log_byte_count = $2::bigint, |
| 303 | version = version + 1, |
| 304 | updated_at = now() |
| 305 | WHERE id = $3::bigint |
| 306 | RETURNING id, job_id, step_index, step_id, step_name, if_expr, |
| 307 | run_command, uses_alias, working_directory, step_env, |
| 308 | continue_on_error, status, conclusion, log_object_key, |
| 309 | log_byte_count, started_at, completed_at, version, |
| 310 | created_at, updated_at, step_with |
| 311 | ` |
| 312 | |
| 313 | type UpdateWorkflowStepLogObjectParams struct { |
| 314 | LogObjectKey pgtype.Text |
| 315 | LogByteCount int64 |
| 316 | ID int64 |
| 317 | } |
| 318 | |
| 319 | func (q *Queries) UpdateWorkflowStepLogObject(ctx context.Context, db DBTX, arg UpdateWorkflowStepLogObjectParams) (WorkflowStep, error) { |
| 320 | row := db.QueryRow(ctx, updateWorkflowStepLogObject, arg.LogObjectKey, arg.LogByteCount, arg.ID) |
| 321 | var i WorkflowStep |
| 322 | err := row.Scan( |
| 323 | &i.ID, |
| 324 | &i.JobID, |
| 325 | &i.StepIndex, |
| 326 | &i.StepID, |
| 327 | &i.StepName, |
| 328 | &i.IfExpr, |
| 329 | &i.RunCommand, |
| 330 | &i.UsesAlias, |
| 331 | &i.WorkingDirectory, |
| 332 | &i.StepEnv, |
| 333 | &i.ContinueOnError, |
| 334 | &i.Status, |
| 335 | &i.Conclusion, |
| 336 | &i.LogObjectKey, |
| 337 | &i.LogByteCount, |
| 338 | &i.StartedAt, |
| 339 | &i.CompletedAt, |
| 340 | &i.Version, |
| 341 | &i.CreatedAt, |
| 342 | &i.UpdatedAt, |
| 343 | &i.StepWith, |
| 344 | ) |
| 345 | return i, err |
| 346 | } |
| 347 | |
| 348 | const updateWorkflowStepStatus = `-- name: UpdateWorkflowStepStatus :one |
| 349 | UPDATE workflow_steps |
| 350 | SET status = $2, |
| 351 | conclusion = $3::check_conclusion, |
| 352 | started_at = $4::timestamptz, |
| 353 | completed_at = $5::timestamptz, |
| 354 | version = version + 1, |
| 355 | updated_at = now() |
| 356 | WHERE id = $1 |
| 357 | RETURNING id, job_id, step_index, step_id, step_name, if_expr, |
| 358 | run_command, uses_alias, working_directory, step_env, |
| 359 | continue_on_error, status, conclusion, log_object_key, |
| 360 | log_byte_count, started_at, completed_at, version, |
| 361 | created_at, updated_at, step_with |
| 362 | ` |
| 363 | |
| 364 | type UpdateWorkflowStepStatusParams struct { |
| 365 | ID int64 |
| 366 | Status WorkflowStepStatus |
| 367 | Conclusion NullCheckConclusion |
| 368 | StartedAt pgtype.Timestamptz |
| 369 | CompletedAt pgtype.Timestamptz |
| 370 | } |
| 371 | |
| 372 | func (q *Queries) UpdateWorkflowStepStatus(ctx context.Context, db DBTX, arg UpdateWorkflowStepStatusParams) (WorkflowStep, error) { |
| 373 | row := db.QueryRow(ctx, updateWorkflowStepStatus, |
| 374 | arg.ID, |
| 375 | arg.Status, |
| 376 | arg.Conclusion, |
| 377 | arg.StartedAt, |
| 378 | arg.CompletedAt, |
| 379 | ) |
| 380 | var i WorkflowStep |
| 381 | err := row.Scan( |
| 382 | &i.ID, |
| 383 | &i.JobID, |
| 384 | &i.StepIndex, |
| 385 | &i.StepID, |
| 386 | &i.StepName, |
| 387 | &i.IfExpr, |
| 388 | &i.RunCommand, |
| 389 | &i.UsesAlias, |
| 390 | &i.WorkingDirectory, |
| 391 | &i.StepEnv, |
| 392 | &i.ContinueOnError, |
| 393 | &i.Status, |
| 394 | &i.Conclusion, |
| 395 | &i.LogObjectKey, |
| 396 | &i.LogByteCount, |
| 397 | &i.StartedAt, |
| 398 | &i.CompletedAt, |
| 399 | &i.Version, |
| 400 | &i.CreatedAt, |
| 401 | &i.UpdatedAt, |
| 402 | &i.StepWith, |
| 403 | ) |
| 404 | return i, err |
| 405 | } |
| 406 |