// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.31.1 // source: workflow_step_log_chunks.sql package actionsdb import ( "context" "github.com/jackc/pgx/v5/pgtype" ) const appendStepLogChunk = `-- name: AppendStepLogChunk :one INSERT INTO workflow_step_log_chunks (step_id, seq, chunk) VALUES ($1, $2, $3) ON CONFLICT (step_id, seq) DO NOTHING RETURNING id, step_id, seq, created_at ` type AppendStepLogChunkParams struct { StepID int64 Seq int32 Chunk []byte } type AppendStepLogChunkRow struct { ID int64 StepID int64 Seq int32 CreatedAt pgtype.Timestamptz } // SPDX-License-Identifier: AGPL-3.0-or-later func (q *Queries) AppendStepLogChunk(ctx context.Context, db DBTX, arg AppendStepLogChunkParams) (AppendStepLogChunkRow, error) { row := db.QueryRow(ctx, appendStepLogChunk, arg.StepID, arg.Seq, arg.Chunk) var i AppendStepLogChunkRow err := row.Scan( &i.ID, &i.StepID, &i.Seq, &i.CreatedAt, ) return i, err } const deleteStepLogChunks = `-- name: DeleteStepLogChunks :exec DELETE FROM workflow_step_log_chunks WHERE step_id = $1 ` func (q *Queries) DeleteStepLogChunks(ctx context.Context, db DBTX, stepID int64) error { _, err := db.Exec(ctx, deleteStepLogChunks, stepID) return err } const getStepLogChunkBefore = `-- name: GetStepLogChunkBefore :one SELECT id, step_id, seq, chunk, created_at FROM workflow_step_log_chunks WHERE step_id = $1 AND seq < $2 ORDER BY seq DESC LIMIT 1 ` type GetStepLogChunkBeforeParams struct { StepID int64 Seq int32 } func (q *Queries) GetStepLogChunkBefore(ctx context.Context, db DBTX, arg GetStepLogChunkBeforeParams) (WorkflowStepLogChunk, error) { row := db.QueryRow(ctx, getStepLogChunkBefore, arg.StepID, arg.Seq) var i WorkflowStepLogChunk err := row.Scan( &i.ID, &i.StepID, &i.Seq, &i.Chunk, &i.CreatedAt, ) return i, err } const getStepLogChunkByStepSeq = `-- name: GetStepLogChunkByStepSeq :one SELECT id, step_id, seq, chunk, created_at FROM workflow_step_log_chunks WHERE step_id = $1 AND seq = $2 ` type GetStepLogChunkByStepSeqParams struct { StepID int64 Seq int32 } func (q *Queries) GetStepLogChunkByStepSeq(ctx context.Context, db DBTX, arg GetStepLogChunkByStepSeqParams) (WorkflowStepLogChunk, error) { row := db.QueryRow(ctx, getStepLogChunkByStepSeq, arg.StepID, arg.Seq) var i WorkflowStepLogChunk err := row.Scan( &i.ID, &i.StepID, &i.Seq, &i.Chunk, &i.CreatedAt, ) return i, err } const listAllStepLogChunksForStep = `-- name: ListAllStepLogChunksForStep :many SELECT id, step_id, seq, chunk, created_at FROM workflow_step_log_chunks WHERE step_id = $1 ORDER BY seq ASC ` func (q *Queries) ListAllStepLogChunksForStep(ctx context.Context, db DBTX, stepID int64) ([]WorkflowStepLogChunk, error) { rows, err := db.Query(ctx, listAllStepLogChunksForStep, stepID) if err != nil { return nil, err } defer rows.Close() items := []WorkflowStepLogChunk{} for rows.Next() { var i WorkflowStepLogChunk if err := rows.Scan( &i.ID, &i.StepID, &i.Seq, &i.Chunk, &i.CreatedAt, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const listStepLogChunks = `-- name: ListStepLogChunks :many SELECT id, step_id, seq, chunk, created_at FROM workflow_step_log_chunks WHERE step_id = $1 AND seq > $2 ORDER BY seq ASC LIMIT $3 ` type ListStepLogChunksParams struct { StepID int64 Seq int32 Limit int32 } func (q *Queries) ListStepLogChunks(ctx context.Context, db DBTX, arg ListStepLogChunksParams) ([]WorkflowStepLogChunk, error) { rows, err := db.Query(ctx, listStepLogChunks, arg.StepID, arg.Seq, arg.Limit) if err != nil { return nil, err } defer rows.Close() items := []WorkflowStepLogChunk{} for rows.Next() { var i WorkflowStepLogChunk if err := rows.Scan( &i.ID, &i.StepID, &i.Seq, &i.Chunk, &i.CreatedAt, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const updateStepLogChunk = `-- name: UpdateStepLogChunk :exec UPDATE workflow_step_log_chunks SET chunk = $2 WHERE id = $1 ` type UpdateStepLogChunkParams struct { ID int64 Chunk []byte } func (q *Queries) UpdateStepLogChunk(ctx context.Context, db DBTX, arg UpdateStepLogChunkParams) error { _, err := db.Exec(ctx, updateStepLogChunk, arg.ID, arg.Chunk) return err }