// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.31.1 // source: workflow_steps.sql package actionsdb import ( "context" "github.com/jackc/pgx/v5/pgtype" ) const getFirstStepForJob = `-- name: GetFirstStepForJob :one SELECT id, job_id, step_index, step_id, step_name, if_expr, run_command, uses_alias, working_directory, step_env, continue_on_error, status, conclusion, log_object_key, log_byte_count, started_at, completed_at, version, created_at, updated_at, step_with FROM workflow_steps WHERE job_id = $1 ORDER BY step_index ASC LIMIT 1 ` func (q *Queries) GetFirstStepForJob(ctx context.Context, db DBTX, jobID int64) (WorkflowStep, error) { row := db.QueryRow(ctx, getFirstStepForJob, jobID) var i WorkflowStep err := row.Scan( &i.ID, &i.JobID, &i.StepIndex, &i.StepID, &i.StepName, &i.IfExpr, &i.RunCommand, &i.UsesAlias, &i.WorkingDirectory, &i.StepEnv, &i.ContinueOnError, &i.Status, &i.Conclusion, &i.LogObjectKey, &i.LogByteCount, &i.StartedAt, &i.CompletedAt, &i.Version, &i.CreatedAt, &i.UpdatedAt, &i.StepWith, ) return i, err } const getWorkflowStepByID = `-- name: GetWorkflowStepByID :one SELECT id, job_id, step_index, step_id, step_name, if_expr, run_command, uses_alias, working_directory, step_env, continue_on_error, status, conclusion, log_object_key, log_byte_count, started_at, completed_at, version, created_at, updated_at, step_with FROM workflow_steps WHERE id = $1 ` func (q *Queries) GetWorkflowStepByID(ctx context.Context, db DBTX, id int64) (WorkflowStep, error) { row := db.QueryRow(ctx, getWorkflowStepByID, id) var i WorkflowStep err := row.Scan( &i.ID, &i.JobID, &i.StepIndex, &i.StepID, &i.StepName, &i.IfExpr, &i.RunCommand, &i.UsesAlias, &i.WorkingDirectory, &i.StepEnv, &i.ContinueOnError, &i.Status, &i.Conclusion, &i.LogObjectKey, &i.LogByteCount, &i.StartedAt, &i.CompletedAt, &i.Version, &i.CreatedAt, &i.UpdatedAt, &i.StepWith, ) return i, err } const insertWorkflowStep = `-- name: InsertWorkflowStep :one INSERT INTO workflow_steps ( job_id, step_index, step_id, step_name, if_expr, run_command, uses_alias, working_directory, step_env, continue_on_error, step_with ) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11 ) RETURNING id, job_id, step_index, step_id, step_name, if_expr, run_command, uses_alias, working_directory, step_env, continue_on_error, status, conclusion, log_object_key, log_byte_count, started_at, completed_at, version, created_at, updated_at, step_with ` type InsertWorkflowStepParams struct { JobID int64 StepIndex int32 StepID string StepName string IfExpr string RunCommand string UsesAlias string WorkingDirectory string StepEnv []byte ContinueOnError bool StepWith []byte } // SPDX-License-Identifier: AGPL-3.0-or-later func (q *Queries) InsertWorkflowStep(ctx context.Context, db DBTX, arg InsertWorkflowStepParams) (WorkflowStep, error) { row := db.QueryRow(ctx, insertWorkflowStep, arg.JobID, arg.StepIndex, arg.StepID, arg.StepName, arg.IfExpr, arg.RunCommand, arg.UsesAlias, arg.WorkingDirectory, arg.StepEnv, arg.ContinueOnError, arg.StepWith, ) var i WorkflowStep err := row.Scan( &i.ID, &i.JobID, &i.StepIndex, &i.StepID, &i.StepName, &i.IfExpr, &i.RunCommand, &i.UsesAlias, &i.WorkingDirectory, &i.StepEnv, &i.ContinueOnError, &i.Status, &i.Conclusion, &i.LogObjectKey, &i.LogByteCount, &i.StartedAt, &i.CompletedAt, &i.Version, &i.CreatedAt, &i.UpdatedAt, &i.StepWith, ) return i, err } const listRunnerStepsForJob = `-- name: ListRunnerStepsForJob :many SELECT id, job_id, step_index, step_id, step_name, if_expr, run_command, uses_alias, working_directory, step_env, continue_on_error, status, conclusion, log_byte_count, started_at, completed_at, created_at, step_with FROM workflow_steps WHERE job_id = $1 ORDER BY step_index ASC ` type ListRunnerStepsForJobRow struct { ID int64 JobID int64 StepIndex int32 StepID string StepName string IfExpr string RunCommand string UsesAlias string WorkingDirectory string StepEnv []byte ContinueOnError bool Status WorkflowStepStatus Conclusion NullCheckConclusion LogByteCount int64 StartedAt pgtype.Timestamptz CompletedAt pgtype.Timestamptz CreatedAt pgtype.Timestamptz StepWith []byte } func (q *Queries) ListRunnerStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]ListRunnerStepsForJobRow, error) { rows, err := db.Query(ctx, listRunnerStepsForJob, jobID) if err != nil { return nil, err } defer rows.Close() items := []ListRunnerStepsForJobRow{} for rows.Next() { var i ListRunnerStepsForJobRow if err := rows.Scan( &i.ID, &i.JobID, &i.StepIndex, &i.StepID, &i.StepName, &i.IfExpr, &i.RunCommand, &i.UsesAlias, &i.WorkingDirectory, &i.StepEnv, &i.ContinueOnError, &i.Status, &i.Conclusion, &i.LogByteCount, &i.StartedAt, &i.CompletedAt, &i.CreatedAt, &i.StepWith, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const listStepsForJob = `-- name: ListStepsForJob :many SELECT id, job_id, step_index, step_id, step_name, run_command, uses_alias, status, conclusion, log_byte_count, started_at, completed_at, created_at FROM workflow_steps WHERE job_id = $1 ORDER BY step_index ASC ` type ListStepsForJobRow struct { ID int64 JobID int64 StepIndex int32 StepID string StepName string RunCommand string UsesAlias string Status WorkflowStepStatus Conclusion NullCheckConclusion LogByteCount int64 StartedAt pgtype.Timestamptz CompletedAt pgtype.Timestamptz CreatedAt pgtype.Timestamptz } func (q *Queries) ListStepsForJob(ctx context.Context, db DBTX, jobID int64) ([]ListStepsForJobRow, error) { rows, err := db.Query(ctx, listStepsForJob, jobID) if err != nil { return nil, err } defer rows.Close() items := []ListStepsForJobRow{} for rows.Next() { var i ListStepsForJobRow if err := rows.Scan( &i.ID, &i.JobID, &i.StepIndex, &i.StepID, &i.StepName, &i.RunCommand, &i.UsesAlias, &i.Status, &i.Conclusion, &i.LogByteCount, &i.StartedAt, &i.CompletedAt, &i.CreatedAt, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Err(); err != nil { return nil, err } return items, nil }