// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.29.0
// source: copyfrom.go

package sqlcv1

import (
	"context"
)

// iteratorForBulkAddMessage implements pgx.CopyFromSource.
type iteratorForBulkAddMessage struct {
	rows                 []BulkAddMessageParams
	skippedFirstNextCall bool
}

func (r *iteratorForBulkAddMessage) Next() bool {
	if len(r.rows) == 0 {
		return false
	}
	if !r.skippedFirstNextCall {
		r.skippedFirstNextCall = true
		return true
	}
	r.rows = r.rows[1:]
	return len(r.rows) > 0
}

func (r iteratorForBulkAddMessage) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].Payload,
		r.rows[0].QueueId,
		r.rows[0].ReadAfter,
		r.rows[0].ExpiresAt,
	}, nil
}

func (r iteratorForBulkAddMessage) Err() error {
	return nil
}

func (q *Queries) BulkAddMessage(ctx context.Context, db DBTX, arg []BulkAddMessageParams) (int64, error) {
	return db.CopyFrom(ctx, []string{"MessageQueueItem"}, []string{"payload", "queueId", "readAfter", "expiresAt"}, &iteratorForBulkAddMessage{rows: arg})
}

// iteratorForBulkCreateEventTriggers implements pgx.CopyFromSource.
type iteratorForBulkCreateEventTriggers struct {
	rows                 []BulkCreateEventTriggersParams
	skippedFirstNextCall bool
}

func (r *iteratorForBulkCreateEventTriggers) Next() bool {
	if len(r.rows) == 0 {
		return false
	}
	if !r.skippedFirstNextCall {
		r.skippedFirstNextCall = true
		return true
	}
	r.rows = r.rows[1:]
	return len(r.rows) > 0
}

func (r iteratorForBulkCreateEventTriggers) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].RunID,
		r.rows[0].RunInsertedAt,
		r.rows[0].EventID,
		r.rows[0].EventSeenAt,
		r.rows[0].FilterID,
	}, nil
}

func (r iteratorForBulkCreateEventTriggers) Err() error {
	return nil
}

func (q *Queries) BulkCreateEventTriggers(ctx context.Context, db DBTX, arg []BulkCreateEventTriggersParams) (int64, error) {
	return db.CopyFrom(ctx, []string{"v1_event_to_run_olap"}, []string{"run_id", "run_inserted_at", "event_id", "event_seen_at", "filter_id"}, &iteratorForBulkCreateEventTriggers{rows: arg})
}

// iteratorForCreateDAGData implements pgx.CopyFromSource.
type iteratorForCreateDAGData struct {
	rows                 []CreateDAGDataParams
	skippedFirstNextCall bool
}

func (r *iteratorForCreateDAGData) Next() bool {
	if len(r.rows) == 0 {
		return false
	}
	if !r.skippedFirstNextCall {
		r.skippedFirstNextCall = true
		return true
	}
	r.rows = r.rows[1:]
	return len(r.rows) > 0
}

func (r iteratorForCreateDAGData) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].DagID,
		r.rows[0].DagInsertedAt,
		r.rows[0].Input,
		r.rows[0].AdditionalMetadata,
	}, nil
}

func (r iteratorForCreateDAGData) Err() error {
	return nil
}

func (q *Queries) CreateDAGData(ctx context.Context, db DBTX, arg []CreateDAGDataParams) (int64, error) {
	return db.CopyFrom(ctx, []string{"v1_dag_data"}, []string{"dag_id", "dag_inserted_at", "input", "additional_metadata"}, &iteratorForCreateDAGData{rows: arg})
}

// iteratorForCreateMatchConditions implements pgx.CopyFromSource.
type iteratorForCreateMatchConditions struct {
	rows                 []CreateMatchConditionsParams
	skippedFirstNextCall bool
}

func (r *iteratorForCreateMatchConditions) Next() bool {
	if len(r.rows) == 0 {
		return false
	}
	if !r.skippedFirstNextCall {
		r.skippedFirstNextCall = true
		return true
	}
	r.rows = r.rows[1:]
	return len(r.rows) > 0
}

func (r iteratorForCreateMatchConditions) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].V1MatchID,
		r.rows[0].TenantID,
		r.rows[0].EventType,
		r.rows[0].EventKey,
		r.rows[0].EventResourceHint,
		r.rows[0].ReadableDataKey,
		r.rows[0].OrGroupID,
		r.rows[0].Expression,
		r.rows[0].Action,
		r.rows[0].IsSatisfied,
		r.rows[0].Data,
	}, nil
}

func (r iteratorForCreateMatchConditions) Err() error {
	return nil
}

func (q *Queries) CreateMatchConditions(ctx context.Context, db DBTX, arg []CreateMatchConditionsParams) (int64, error) {
	return db.CopyFrom(ctx, []string{"v1_match_condition"}, []string{"v1_match_id", "tenant_id", "event_type", "event_key", "event_resource_hint", "readable_data_key", "or_group_id", "expression", "action", "is_satisfied", "data"}, &iteratorForCreateMatchConditions{rows: arg})
}

// iteratorForCreateTaskEventsOLAP implements pgx.CopyFromSource.
type iteratorForCreateTaskEventsOLAP struct {
	rows                 []CreateTaskEventsOLAPParams
	skippedFirstNextCall bool
}

func (r *iteratorForCreateTaskEventsOLAP) Next() bool {
	if len(r.rows) == 0 {
		return false
	}
	if !r.skippedFirstNextCall {
		r.skippedFirstNextCall = true
		return true
	}
	r.rows = r.rows[1:]
	return len(r.rows) > 0
}

func (r iteratorForCreateTaskEventsOLAP) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].TenantID,
		r.rows[0].TaskID,
		r.rows[0].TaskInsertedAt,
		r.rows[0].EventType,
		r.rows[0].WorkflowID,
		r.rows[0].EventTimestamp,
		r.rows[0].ReadableStatus,
		r.rows[0].RetryCount,
		r.rows[0].ErrorMessage,
		r.rows[0].Output,
		r.rows[0].WorkerID,
		r.rows[0].AdditionalEventData,
		r.rows[0].AdditionalEventMessage,
		r.rows[0].ExternalID,
		r.rows[0].DurableInvocationCount,
	}, nil
}

func (r iteratorForCreateTaskEventsOLAP) Err() error {
	return nil
}

func (q *Queries) CreateTaskEventsOLAP(ctx context.Context, db DBTX, arg []CreateTaskEventsOLAPParams) (int64, error) {
	return db.CopyFrom(ctx, []string{"v1_task_events_olap"}, []string{"tenant_id", "task_id", "task_inserted_at", "event_type", "workflow_id", "event_timestamp", "readable_status", "retry_count", "error_message", "output", "worker_id", "additional__event_data", "additional__event_message", "external_id", "durable_invocation_count"}, &iteratorForCreateTaskEventsOLAP{rows: arg})
}

// iteratorForInsertLogLine implements pgx.CopyFromSource.
type iteratorForInsertLogLine struct {
	rows                 []InsertLogLineParams
	skippedFirstNextCall bool
}

func (r *iteratorForInsertLogLine) Next() bool {
	if len(r.rows) == 0 {
		return false
	}
	if !r.skippedFirstNextCall {
		r.skippedFirstNextCall = true
		return true
	}
	r.rows = r.rows[1:]
	return len(r.rows) > 0
}

func (r iteratorForInsertLogLine) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].TenantID,
		r.rows[0].TaskID,
		r.rows[0].TaskInsertedAt,
		r.rows[0].Message,
		r.rows[0].Metadata,
		r.rows[0].RetryCount,
		r.rows[0].Level,
		r.rows[0].WorkflowID,
		r.rows[0].StepID,
	}, nil
}

func (r iteratorForInsertLogLine) Err() error {
	return nil
}

func (q *Queries) InsertLogLine(ctx context.Context, db DBTX, arg []InsertLogLineParams) (int64, error) {
	return db.CopyFrom(ctx, []string{"v1_log_line"}, []string{"tenant_id", "task_id", "task_inserted_at", "message", "metadata", "retry_count", "level", "workflow_id", "step_id"}, &iteratorForInsertLogLine{rows: arg})
}
