Merged in feature/batch-status (pull request #215)
Implement and test the batch status feature * working
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// sqlc v1.27.0
|
||||
|
||||
package repository
|
||||
|
||||
@@ -12,6 +12,79 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
type BatchOutcomeStatus string
|
||||
|
||||
const (
|
||||
BatchOutcomeStatusSubmitted BatchOutcomeStatus = "submitted"
|
||||
BatchOutcomeStatusDuplicate BatchOutcomeStatus = "duplicate"
|
||||
BatchOutcomeStatusFailedOpen BatchOutcomeStatus = "failed_open"
|
||||
BatchOutcomeStatusFailedRead BatchOutcomeStatus = "failed_read"
|
||||
BatchOutcomeStatusFailedS3Upload BatchOutcomeStatus = "failed_s3_upload"
|
||||
BatchOutcomeStatusFailedUpload BatchOutcomeStatus = "failed_upload"
|
||||
BatchOutcomeStatusInvalidType BatchOutcomeStatus = "invalid_type"
|
||||
BatchOutcomeStatusInitComplete BatchOutcomeStatus = "init_complete"
|
||||
BatchOutcomeStatusInitDuplicate BatchOutcomeStatus = "init_duplicate"
|
||||
BatchOutcomeStatusSyncComplete BatchOutcomeStatus = "sync_complete"
|
||||
BatchOutcomeStatusSyncSkipped BatchOutcomeStatus = "sync_skipped"
|
||||
BatchOutcomeStatusCleanPassed BatchOutcomeStatus = "clean_passed"
|
||||
BatchOutcomeStatusCleanFailed BatchOutcomeStatus = "clean_failed"
|
||||
)
|
||||
|
||||
func (e *BatchOutcomeStatus) Scan(src interface{}) error {
|
||||
switch s := src.(type) {
|
||||
case []byte:
|
||||
*e = BatchOutcomeStatus(s)
|
||||
case string:
|
||||
*e = BatchOutcomeStatus(s)
|
||||
default:
|
||||
return fmt.Errorf("unsupported scan type for BatchOutcomeStatus: %T", src)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NullBatchOutcomeStatus struct {
|
||||
BatchOutcomeStatus BatchOutcomeStatus
|
||||
Valid bool // Valid is true if BatchOutcomeStatus is not NULL
|
||||
}
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (ns *NullBatchOutcomeStatus) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
ns.BatchOutcomeStatus, ns.Valid = "", false
|
||||
return nil
|
||||
}
|
||||
ns.Valid = true
|
||||
return ns.BatchOutcomeStatus.Scan(value)
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (ns NullBatchOutcomeStatus) Value() (driver.Value, error) {
|
||||
if !ns.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
return string(ns.BatchOutcomeStatus), nil
|
||||
}
|
||||
|
||||
func (e BatchOutcomeStatus) Valid() bool {
|
||||
switch e {
|
||||
case BatchOutcomeStatusSubmitted,
|
||||
BatchOutcomeStatusDuplicate,
|
||||
BatchOutcomeStatusFailedOpen,
|
||||
BatchOutcomeStatusFailedRead,
|
||||
BatchOutcomeStatusFailedS3Upload,
|
||||
BatchOutcomeStatusFailedUpload,
|
||||
BatchOutcomeStatusInvalidType,
|
||||
BatchOutcomeStatusInitComplete,
|
||||
BatchOutcomeStatusInitDuplicate,
|
||||
BatchOutcomeStatusSyncComplete,
|
||||
BatchOutcomeStatusSyncSkipped,
|
||||
BatchOutcomeStatusCleanPassed,
|
||||
BatchOutcomeStatusCleanFailed:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type BatchStatus string
|
||||
|
||||
const (
|
||||
@@ -181,6 +254,17 @@ func (e Cleanmimetype) Valid() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type BatchDocumentOutcome struct {
|
||||
ID uuid.UUID `db:"id"`
|
||||
BatchID uuid.UUID `db:"batch_id"`
|
||||
Filename string `db:"filename"`
|
||||
Outcome BatchOutcomeStatus `db:"outcome"`
|
||||
ErrorDetail *string `db:"error_detail"`
|
||||
DocumentID *uuid.UUID `db:"document_id"`
|
||||
UpdatedAt pgtype.Timestamp `db:"updated_at"`
|
||||
CreatedAt pgtype.Timestamp `db:"created_at"`
|
||||
}
|
||||
|
||||
type BatchUpload struct {
|
||||
ID uuid.UUID `db:"id"`
|
||||
ClientID string `db:"client_id"`
|
||||
|
||||
Reference in New Issue
Block a user