batchsqlc

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	ID          uuid.UUID        `json:"id"`
	App         string           `json:"app"`
	Op          string           `json:"op"`
	Context     []byte           `json:"context"`
	Inputfile   pgtype.Text      `json:"inputfile"`
	Status      StatusEnum       `json:"status"`
	Reqat       pgtype.Timestamp `json:"reqat"`
	Doneat      pgtype.Timestamp `json:"doneat"`
	Outputfiles []byte           `json:"outputfiles"`
	Nsuccess    pgtype.Int4      `json:"nsuccess"`
	Nfailed     pgtype.Int4      `json:"nfailed"`
	Naborted    pgtype.Int4      `json:"naborted"`
	CreatedAt   pgtype.Timestamp `json:"created_at"`
}

type BatchFile added in v0.12.0

type BatchFile struct {
	// Unique identifier for each batch file record
	ID int32 `json:"id"`
	// Reference to the associated batch in the batches table
	BatchID uuid.UUID `json:"batch_id"`
	// Unique identifier for the file in the object store
	ObjectID string `json:"object_id"`
	// Original name of the file
	Filename string `json:"filename"`
	// Size of the file in bytes
	Size int64 `json:"size"`
	// Hash or checksum of the file contents for integrity verification
	Checksum string `json:"checksum"`
	// MIME type of the file
	ContentType string `json:"content_type"`
	// Indicates whether the file was successfully processed (TRUE) or failed (FALSE)
	Status bool `json:"status"`
	// Timestamp when the file was received and stored in the object store
	ReceivedAt pgtype.Timestamptz `json:"received_at"`
	// Timestamp when the file was processed by the batch system
	ProcessedAt pgtype.Timestamptz `json:"processed_at"`
	// Contains any error message if the file processing failed
	ErrorMessage pgtype.Text `json:"error_message"`
	// Additional metadata about the file in JSONB format
	Metadata  []byte           `json:"metadata"`
	CreatedAt pgtype.Timestamp `json:"created_at"`
}

Stores metadata for files associated with batch jobs

type Batchrow

type Batchrow struct {
	Rowid     int64            `json:"rowid"`
	Batch     uuid.UUID        `json:"batch"`
	Line      int32            `json:"line"`
	Input     []byte           `json:"input"`
	Status    StatusEnum       `json:"status"`
	Reqat     pgtype.Timestamp `json:"reqat"`
	Doneat    pgtype.Timestamp `json:"doneat"`
	Res       []byte           `json:"res"`
	Blobrows  []byte           `json:"blobrows"`
	Messages  []byte           `json:"messages"`
	Doneby    pgtype.Text      `json:"doneby"`
	CreatedAt pgtype.Timestamp `json:"created_at"`
}

type BulkInsertIntoBatchRowsParams

type BulkInsertIntoBatchRowsParams struct {
	Batch []uuid.UUID        `json:"batch"`
	Line  []int32            `json:"line"`
	Input [][]byte           `json:"input"`
	Reqat []pgtype.Timestamp `json:"reqat"`
}

type CountBatchRowsByBatchIDAndStatusParams

type CountBatchRowsByBatchIDAndStatusParams struct {
	Batch    uuid.UUID  `json:"batch"`
	Status   StatusEnum `json:"status"`
	Status_2 StatusEnum `json:"status_2"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type FetchBatchRowsForBatchDoneRow

type FetchBatchRowsForBatchDoneRow struct {
	Line     int32      `json:"line"`
	Status   StatusEnum `json:"status"`
	Res      []byte     `json:"res"`
	Messages []byte     `json:"messages"`
}

type FetchBlockOfRowsParams

type FetchBlockOfRowsParams struct {
	Status StatusEnum `json:"status"`
	Limit  int32      `json:"limit"`
}

type FetchBlockOfRowsRow

type FetchBlockOfRowsRow struct {
	App     string     `json:"app"`
	Status  StatusEnum `json:"status"`
	Op      string     `json:"op"`
	Context []byte     `json:"context"`
	Batch   uuid.UUID  `json:"batch"`
	Rowid   int64      `json:"rowid"`
	Line    int32      `json:"line"`
	Input   []byte     `json:"input"`
}

type GetBatchRowsByBatchIDSortedRow

type GetBatchRowsByBatchIDSortedRow struct {
	Rowid    int64            `json:"rowid"`
	Line     int32            `json:"line"`
	Input    []byte           `json:"input"`
	Status   StatusEnum       `json:"status"`
	Reqat    pgtype.Timestamp `json:"reqat"`
	Doneat   pgtype.Timestamp `json:"doneat"`
	Res      []byte           `json:"res"`
	Blobrows []byte           `json:"blobrows"`
	Messages []byte           `json:"messages"`
	Doneby   pgtype.Text      `json:"doneby"`
}

type GetBatchStatusAndOutputFilesRow added in v0.13.0

type GetBatchStatusAndOutputFilesRow struct {
	Status      StatusEnum `json:"status"`
	Outputfiles []byte     `json:"outputfiles"`
	Res         []byte     `json:"res"`
}

type GetPendingBatchRowsRow

type GetPendingBatchRowsRow struct {
	Rowid    int64            `json:"rowid"`
	Line     int32            `json:"line"`
	Input    []byte           `json:"input"`
	Status   StatusEnum       `json:"status"`
	Reqat    pgtype.Timestamp `json:"reqat"`
	Doneat   pgtype.Timestamp `json:"doneat"`
	Res      []byte           `json:"res"`
	Blobrows []byte           `json:"blobrows"`
	Messages []byte           `json:"messages"`
	Doneby   pgtype.Text      `json:"doneby"`
}

type GetProcessedBatchRowsByBatchIDSortedRow

type GetProcessedBatchRowsByBatchIDSortedRow struct {
	Rowid    int64            `json:"rowid"`
	Line     int32            `json:"line"`
	Input    []byte           `json:"input"`
	Status   StatusEnum       `json:"status"`
	Reqat    pgtype.Timestamp `json:"reqat"`
	Doneat   pgtype.Timestamp `json:"doneat"`
	Res      []byte           `json:"res"`
	Blobrows []byte           `json:"blobrows"`
	Messages []byte           `json:"messages"`
	Doneby   pgtype.Text      `json:"doneby"`
}

type InsertBatchFileParams added in v0.12.0

type InsertBatchFileParams struct {
	BatchID     uuid.UUID          `json:"batch_id"`
	ObjectID    string             `json:"object_id"`
	Filename    string             `json:"filename"`
	Size        int64              `json:"size"`
	Checksum    string             `json:"checksum"`
	ContentType string             `json:"content_type"`
	Status      bool               `json:"status"`
	ReceivedAt  pgtype.Timestamptz `json:"received_at"`
	Metadata    []byte             `json:"metadata"`
}

type InsertIntoBatchRowsParams

type InsertIntoBatchRowsParams struct {
	Batch uuid.UUID        `json:"batch"`
	Line  int32            `json:"line"`
	Input []byte           `json:"input"`
	Reqat pgtype.Timestamp `json:"reqat"`
}

type InsertIntoBatchesParams

type InsertIntoBatchesParams struct {
	ID      uuid.UUID        `json:"id"`
	App     string           `json:"app"`
	Op      string           `json:"op"`
	Context []byte           `json:"context"`
	Status  StatusEnum       `json:"status"`
	Reqat   pgtype.Timestamp `json:"reqat"`
}

type NullStatusEnum

type NullStatusEnum struct {
	StatusEnum StatusEnum `json:"status_enum"`
	Valid      bool       `json:"valid"` // Valid is true if StatusEnum is not NULL
}

func (*NullStatusEnum) Scan

func (ns *NullStatusEnum) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullStatusEnum) Value

func (ns NullStatusEnum) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Querier

type Querier interface {
	BulkInsertIntoBatchRows(ctx context.Context, arg BulkInsertIntoBatchRowsParams) (int64, error)
	CountBatchRowsByBatchIDAndStatus(ctx context.Context, arg CountBatchRowsByBatchIDAndStatusParams) (int64, error)
	FetchBatchRowsForBatchDone(ctx context.Context, batch uuid.UUID) ([]FetchBatchRowsForBatchDoneRow, error)
	FetchBlockOfRows(ctx context.Context, arg FetchBlockOfRowsParams) ([]FetchBlockOfRowsRow, error)
	GetBatchByID(ctx context.Context, id uuid.UUID) (Batch, error)
	GetBatchRowsByBatchID(ctx context.Context, batch uuid.UUID) ([]Batchrow, error)
	GetBatchRowsByBatchIDSorted(ctx context.Context, batch uuid.UUID) ([]GetBatchRowsByBatchIDSortedRow, error)
	GetBatchRowsCount(ctx context.Context, batch uuid.UUID) (int64, error)
	GetBatchStatus(ctx context.Context, id uuid.UUID) (StatusEnum, error)
	GetBatchStatusAndOutputFiles(ctx context.Context, id uuid.UUID) (GetBatchStatusAndOutputFilesRow, error)
	GetCompletedBatches(ctx context.Context) ([]uuid.UUID, error)
	GetPendingBatchRows(ctx context.Context, batch uuid.UUID) ([]GetPendingBatchRowsRow, error)
	GetProcessedBatchRowsByBatchIDSorted(ctx context.Context, batch uuid.UUID) ([]GetProcessedBatchRowsByBatchIDSortedRow, error)
	InsertBatchFile(ctx context.Context, arg InsertBatchFileParams) error
	InsertIntoBatchRows(ctx context.Context, arg InsertIntoBatchRowsParams) error
	InsertIntoBatches(ctx context.Context, arg InsertIntoBatchesParams) (uuid.UUID, error)
	UpdateBatchCounters(ctx context.Context, arg UpdateBatchCountersParams) error
	UpdateBatchOutputFiles(ctx context.Context, arg UpdateBatchOutputFilesParams) error
	UpdateBatchResult(ctx context.Context, arg UpdateBatchResultParams) error
	UpdateBatchRowStatus(ctx context.Context, arg UpdateBatchRowStatusParams) error
	UpdateBatchRowsBatchJob(ctx context.Context, arg UpdateBatchRowsBatchJobParams) error
	UpdateBatchRowsSlowQuery(ctx context.Context, arg UpdateBatchRowsSlowQueryParams) error
	UpdateBatchRowsStatus(ctx context.Context, arg UpdateBatchRowsStatusParams) error
	UpdateBatchStatus(ctx context.Context, arg UpdateBatchStatusParams) error
	UpdateBatchSummary(ctx context.Context, arg UpdateBatchSummaryParams) error
	UpdateBatchSummaryOnAbort(ctx context.Context, arg UpdateBatchSummaryOnAbortParams) error
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) BulkInsertIntoBatchRows

func (q *Queries) BulkInsertIntoBatchRows(ctx context.Context, arg BulkInsertIntoBatchRowsParams) (int64, error)

func (*Queries) CountBatchRowsByBatchIDAndStatus

func (q *Queries) CountBatchRowsByBatchIDAndStatus(ctx context.Context, arg CountBatchRowsByBatchIDAndStatusParams) (int64, error)

func (*Queries) FetchBatchRowsForBatchDone

func (q *Queries) FetchBatchRowsForBatchDone(ctx context.Context, batch uuid.UUID) ([]FetchBatchRowsForBatchDoneRow, error)

func (*Queries) FetchBlockOfRows

func (q *Queries) FetchBlockOfRows(ctx context.Context, arg FetchBlockOfRowsParams) ([]FetchBlockOfRowsRow, error)

func (*Queries) GetBatchByID

func (q *Queries) GetBatchByID(ctx context.Context, id uuid.UUID) (Batch, error)

func (*Queries) GetBatchRowsByBatchID

func (q *Queries) GetBatchRowsByBatchID(ctx context.Context, batch uuid.UUID) ([]Batchrow, error)

func (*Queries) GetBatchRowsByBatchIDSorted

func (q *Queries) GetBatchRowsByBatchIDSorted(ctx context.Context, batch uuid.UUID) ([]GetBatchRowsByBatchIDSortedRow, error)

func (*Queries) GetBatchRowsCount

func (q *Queries) GetBatchRowsCount(ctx context.Context, batch uuid.UUID) (int64, error)

func (*Queries) GetBatchStatus

func (q *Queries) GetBatchStatus(ctx context.Context, id uuid.UUID) (StatusEnum, error)

func (*Queries) GetBatchStatusAndOutputFiles added in v0.13.0

func (q *Queries) GetBatchStatusAndOutputFiles(ctx context.Context, id uuid.UUID) (GetBatchStatusAndOutputFilesRow, error)

func (*Queries) GetCompletedBatches

func (q *Queries) GetCompletedBatches(ctx context.Context) ([]uuid.UUID, error)

func (*Queries) GetPendingBatchRows

func (q *Queries) GetPendingBatchRows(ctx context.Context, batch uuid.UUID) ([]GetPendingBatchRowsRow, error)

func (*Queries) GetProcessedBatchRowsByBatchIDSorted

func (q *Queries) GetProcessedBatchRowsByBatchIDSorted(ctx context.Context, batch uuid.UUID) ([]GetProcessedBatchRowsByBatchIDSortedRow, error)

func (*Queries) InsertBatchFile added in v0.12.0

func (q *Queries) InsertBatchFile(ctx context.Context, arg InsertBatchFileParams) error

func (*Queries) InsertIntoBatchRows

func (q *Queries) InsertIntoBatchRows(ctx context.Context, arg InsertIntoBatchRowsParams) error

func (*Queries) InsertIntoBatches

func (q *Queries) InsertIntoBatches(ctx context.Context, arg InsertIntoBatchesParams) (uuid.UUID, error)

func (*Queries) UpdateBatchCounters

func (q *Queries) UpdateBatchCounters(ctx context.Context, arg UpdateBatchCountersParams) error

func (*Queries) UpdateBatchOutputFiles

func (q *Queries) UpdateBatchOutputFiles(ctx context.Context, arg UpdateBatchOutputFilesParams) error

func (*Queries) UpdateBatchResult added in v0.13.0

func (q *Queries) UpdateBatchResult(ctx context.Context, arg UpdateBatchResultParams) error

func (*Queries) UpdateBatchRowStatus

func (q *Queries) UpdateBatchRowStatus(ctx context.Context, arg UpdateBatchRowStatusParams) error

func (*Queries) UpdateBatchRowsBatchJob

func (q *Queries) UpdateBatchRowsBatchJob(ctx context.Context, arg UpdateBatchRowsBatchJobParams) error

func (*Queries) UpdateBatchRowsSlowQuery

func (q *Queries) UpdateBatchRowsSlowQuery(ctx context.Context, arg UpdateBatchRowsSlowQueryParams) error

func (*Queries) UpdateBatchRowsStatus

func (q *Queries) UpdateBatchRowsStatus(ctx context.Context, arg UpdateBatchRowsStatusParams) error

func (*Queries) UpdateBatchStatus

func (q *Queries) UpdateBatchStatus(ctx context.Context, arg UpdateBatchStatusParams) error

func (*Queries) UpdateBatchSummary

func (q *Queries) UpdateBatchSummary(ctx context.Context, arg UpdateBatchSummaryParams) error

func (*Queries) UpdateBatchSummaryOnAbort

func (q *Queries) UpdateBatchSummaryOnAbort(ctx context.Context, arg UpdateBatchSummaryOnAbortParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type StatusEnum

type StatusEnum string
const (
	StatusEnumQueued  StatusEnum = "queued"
	StatusEnumInprog  StatusEnum = "inprog"
	StatusEnumSuccess StatusEnum = "success"
	StatusEnumFailed  StatusEnum = "failed"
	StatusEnumAborted StatusEnum = "aborted"
	StatusEnumWait    StatusEnum = "wait"
)

func (*StatusEnum) Scan

func (e *StatusEnum) Scan(src interface{}) error

type UpdateBatchCountersParams

type UpdateBatchCountersParams struct {
	ID       uuid.UUID   `json:"id"`
	Nsuccess pgtype.Int4 `json:"nsuccess"`
	Nfailed  pgtype.Int4 `json:"nfailed"`
	Naborted pgtype.Int4 `json:"naborted"`
}

type UpdateBatchOutputFilesParams

type UpdateBatchOutputFilesParams struct {
	ID          uuid.UUID `json:"id"`
	Outputfiles []byte    `json:"outputfiles"`
}

type UpdateBatchResultParams added in v0.13.0

type UpdateBatchResultParams struct {
	Outputfiles []byte           `json:"outputfiles"`
	Status      StatusEnum       `json:"status"`
	Doneat      pgtype.Timestamp `json:"doneat"`
	ID          uuid.UUID        `json:"id"`
}

type UpdateBatchRowStatusParams

type UpdateBatchRowStatusParams struct {
	Rowid  int64      `json:"rowid"`
	Status StatusEnum `json:"status"`
}

type UpdateBatchRowsBatchJobParams

type UpdateBatchRowsBatchJobParams struct {
	Rowid    int64            `json:"rowid"`
	Status   StatusEnum       `json:"status"`
	Doneat   pgtype.Timestamp `json:"doneat"`
	Res      []byte           `json:"res"`
	Blobrows []byte           `json:"blobrows"`
	Messages []byte           `json:"messages"`
	Doneby   pgtype.Text      `json:"doneby"`
}

type UpdateBatchRowsSlowQueryParams

type UpdateBatchRowsSlowQueryParams struct {
	Rowid    int64            `json:"rowid"`
	Status   StatusEnum       `json:"status"`
	Doneat   pgtype.Timestamp `json:"doneat"`
	Res      []byte           `json:"res"`
	Messages []byte           `json:"messages"`
	Doneby   pgtype.Text      `json:"doneby"`
}

type UpdateBatchRowsStatusParams

type UpdateBatchRowsStatusParams struct {
	Status  StatusEnum `json:"status"`
	Column2 []int64    `json:"column_2"`
}

type UpdateBatchStatusParams

type UpdateBatchStatusParams struct {
	ID          uuid.UUID        `json:"id"`
	Status      StatusEnum       `json:"status"`
	Doneat      pgtype.Timestamp `json:"doneat"`
	Outputfiles []byte           `json:"outputfiles"`
	Nsuccess    pgtype.Int4      `json:"nsuccess"`
	Nfailed     pgtype.Int4      `json:"nfailed"`
	Naborted    pgtype.Int4      `json:"naborted"`
}

type UpdateBatchSummaryOnAbortParams

type UpdateBatchSummaryOnAbortParams struct {
	ID       uuid.UUID        `json:"id"`
	Status   StatusEnum       `json:"status"`
	Doneat   pgtype.Timestamp `json:"doneat"`
	Naborted pgtype.Int4      `json:"naborted"`
}

type UpdateBatchSummaryParams

type UpdateBatchSummaryParams struct {
	ID          uuid.UUID        `json:"id"`
	Status      StatusEnum       `json:"status"`
	Doneat      pgtype.Timestamp `json:"doneat"`
	Outputfiles []byte           `json:"outputfiles"`
	Nsuccess    pgtype.Int4      `json:"nsuccess"`
	Nfailed     pgtype.Int4      `json:"nfailed"`
	Naborted    pgtype.Int4      `json:"naborted"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL