// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.29.0
// source: expiry.sql

package lrdb

import (
	"context"

	"github.com/google/uuid"
)

const callExpirePublishedByIngestCutoff = `-- name: CallExpirePublishedByIngestCutoff :one
SELECT expire_published_by_ingest_cutoff($1::regclass, $2::uuid, $3::integer, $4::integer) AS rows_expired
`

type CallExpirePublishedByIngestCutoffParams struct {
	PartitionName  interface{} `json:"partition_name"`
	OrganizationID uuid.UUID   `json:"organization_id"`
	CutoffDateint  int32       `json:"cutoff_dateint"`
	BatchSize      int32       `json:"batch_size"`
}

func (q *Queries) CallExpirePublishedByIngestCutoff(ctx context.Context, arg CallExpirePublishedByIngestCutoffParams) (int64, error) {
	row := q.db.QueryRow(ctx, callExpirePublishedByIngestCutoff,
		arg.PartitionName,
		arg.OrganizationID,
		arg.CutoffDateint,
		arg.BatchSize,
	)
	var rows_expired int64
	err := row.Scan(&rows_expired)
	return rows_expired, err
}

const callFindOrgPartition = `-- name: CallFindOrgPartition :one
SELECT find_org_partition($1::regclass, $2::uuid)::text AS partition_name
`

type CallFindOrgPartitionParams struct {
	TableName      interface{} `json:"table_name"`
	OrganizationID uuid.UUID   `json:"organization_id"`
}

func (q *Queries) CallFindOrgPartition(ctx context.Context, arg CallFindOrgPartitionParams) (string, error) {
	row := q.db.QueryRow(ctx, callFindOrgPartition, arg.TableName, arg.OrganizationID)
	var partition_name string
	err := row.Scan(&partition_name)
	return partition_name, err
}
