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

package orm

import (
	"context"
)

// iteratorForAddAdjFactors implements pgx.CopyFromSource.
type iteratorForAddAdjFactors struct {
	rows                 []AddAdjFactorsParams
	skippedFirstNextCall bool
}

func (r *iteratorForAddAdjFactors) 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 iteratorForAddAdjFactors) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].Sid,
		r.rows[0].SubID,
		r.rows[0].StartMs,
		r.rows[0].Factor,
	}, nil
}

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

func (q *Queries) AddAdjFactors(ctx context.Context, arg []AddAdjFactorsParams) (int64, error) {
	return q.db.CopyFrom(ctx, []string{"adj_factors"}, []string{"sid", "sub_id", "start_ms", "factor"}, &iteratorForAddAdjFactors{rows: arg})
}

// iteratorForAddCalendars implements pgx.CopyFromSource.
type iteratorForAddCalendars struct {
	rows                 []AddCalendarsParams
	skippedFirstNextCall bool
}

func (r *iteratorForAddCalendars) 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 iteratorForAddCalendars) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].Name,
		r.rows[0].StartMs,
		r.rows[0].StopMs,
	}, nil
}

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

func (q *Queries) AddCalendars(ctx context.Context, arg []AddCalendarsParams) (int64, error) {
	return q.db.CopyFrom(ctx, []string{"calendars"}, []string{"name", "start_ms", "stop_ms"}, &iteratorForAddCalendars{rows: arg})
}

// iteratorForAddKHoles implements pgx.CopyFromSource.
type iteratorForAddKHoles struct {
	rows                 []AddKHolesParams
	skippedFirstNextCall bool
}

func (r *iteratorForAddKHoles) 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 iteratorForAddKHoles) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].Sid,
		r.rows[0].Timeframe,
		r.rows[0].Start,
		r.rows[0].Stop,
		r.rows[0].NoData,
	}, nil
}

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

func (q *Queries) AddKHoles(ctx context.Context, arg []AddKHolesParams) (int64, error) {
	return q.db.CopyFrom(ctx, []string{"khole"}, []string{"sid", "timeframe", "start", "stop", "no_data"}, &iteratorForAddKHoles{rows: arg})
}

// iteratorForAddSymbols implements pgx.CopyFromSource.
type iteratorForAddSymbols struct {
	rows                 []AddSymbolsParams
	skippedFirstNextCall bool
}

func (r *iteratorForAddSymbols) 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 iteratorForAddSymbols) Values() ([]interface{}, error) {
	return []interface{}{
		r.rows[0].Exchange,
		r.rows[0].ExgReal,
		r.rows[0].Market,
		r.rows[0].Symbol,
	}, nil
}

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

func (q *Queries) AddSymbols(ctx context.Context, arg []AddSymbolsParams) (int64, error) {
	return q.db.CopyFrom(ctx, []string{"exsymbol"}, []string{"exchange", "exg_real", "market", "symbol"}, &iteratorForAddSymbols{rows: arg})
}
