Documentation ¶
Index ¶
- Constants
- func CreateStatusAndExceptionTables(ctx context.Context, conn *pgx.Conn) error
- func DeleteAllExceptionLogs(ctx context.Context, conn *pgx.Conn) error
- func ExtractFileNameFromErr(errString string) string
- func GetTableSchemaToExceptionLog(el []*ExceptionLog) map[string]*ExceptionLog
- func MaybeReportException(ctx context.Context, logger zerolog.Logger, conn *pgx.Conn, table dbtable.Name, ...) error
- type ExceptionLog
- func GetAllExceptionLogs(ctx context.Context, conn *pgx.Conn, numResults int) ([]ExceptionLog, error)
- func GetAllExceptionLogsByFetchID(ctx context.Context, conn *pgx.Conn, fetchID string) ([]*ExceptionLog, error)
- func GetExceptionLogByToken(ctx context.Context, conn *pgx.Conn, token string) (*ExceptionLog, error)
- func (l ExceptionLog) Caption() string
- func (e *ExceptionLog) CreateEntry(ctx context.Context, conn *pgx.Conn, stage string) error
- func (e *ExceptionLog) DeleteEntry(ctx context.Context, conn *pgx.Conn) error
- func (l ExceptionLog) JSONFormat() string
- func (l ExceptionLog) TableFormat() []string
- func (l ExceptionLog) TableHeaders() []string
- func (e *ExceptionLog) UpdateEntry(ctx context.Context, conn *pgx.Conn, msg, sqlState, fileName string) error
- type FetchStatus
Constants ¶
View Source
const ( StageSchemaCreation = "schema_creation" StageDataLoad = "data_load" )
Variables ¶
This section is empty.
Functions ¶
func DeleteAllExceptionLogs ¶
Used to clear the continuation tokens on fresh runs.
func ExtractFileNameFromErr ¶
func GetTableSchemaToExceptionLog ¶
func GetTableSchemaToExceptionLog(el []*ExceptionLog) map[string]*ExceptionLog
Types ¶
type ExceptionLog ¶
type ExceptionLog struct { ID uuid.UUID FetchID uuid.UUID Table string Schema string Message string SQLState string FileName string Command string Stage string Time time.Time }
func GetAllExceptionLogs ¶
func GetAllExceptionLogs( ctx context.Context, conn *pgx.Conn, numResults int, ) ([]ExceptionLog, error)
func GetAllExceptionLogsByFetchID ¶
func GetAllExceptionLogsByFetchID( ctx context.Context, conn *pgx.Conn, fetchID string, ) ([]*ExceptionLog, error)
func GetExceptionLogByToken ¶
func GetExceptionLogByToken( ctx context.Context, conn *pgx.Conn, token string, ) (*ExceptionLog, error)
func (ExceptionLog) Caption ¶
func (l ExceptionLog) Caption() string
func (*ExceptionLog) CreateEntry ¶
func (e *ExceptionLog) CreateEntry(ctx context.Context, conn *pgx.Conn, stage string) error
Added logic to be able to set the time from the struct itself to simplify testing. For some of the tests, we must test exceptions created at multiple times in order to properly validate behavior. Testutils.hook for date doesn't work since all entries would end up having the same. In the actual use case (non-testing) the time will be generated as the current time as the logic below shows.
func (*ExceptionLog) DeleteEntry ¶
func (e *ExceptionLog) DeleteEntry(ctx context.Context, conn *pgx.Conn) error
DeleteEntry is used when, on a continuation run, the import succeeds and we want to clear the exception from the table.
func (ExceptionLog) JSONFormat ¶
func (l ExceptionLog) JSONFormat() string
func (ExceptionLog) TableFormat ¶
func (l ExceptionLog) TableFormat() []string
func (ExceptionLog) TableHeaders ¶
func (l ExceptionLog) TableHeaders() []string
func (*ExceptionLog) UpdateEntry ¶
func (e *ExceptionLog) UpdateEntry( ctx context.Context, conn *pgx.Conn, msg, sqlState, fileName string, ) error
type FetchStatus ¶
func (*FetchStatus) CreateEntry ¶
func (s *FetchStatus) CreateEntry(ctx context.Context, conn *pgx.Conn) error
Click to show internal directories.
Click to hide internal directories.