View Source Csv2sql.ProgressTracker (Csv2sql v0.1.0)

This module is responsible for tracking the progress of the operations on different csv files. The various processes working on the csv files can update the progress tracker with the status of the file.

Summary

Types

@type csv_col_types_list() :: [{String.t(), String.t()}]
@type db_result_types() :: MyXQL.Result.t() | Postgrex.Result.t()
@type file_status() :: :pending | :analyze | :loading | :done | :failure
@type files_map() :: %{required(String.t()) => File.t()}
Link to this type

supported_db_data_types()

View Source
@type supported_db_data_types() ::
  String.t() | number() | boolean() | Date.t() | DateTime.t() | nil
@type type_map() :: %{
  is_empty: boolean(),
  is_date: boolean(),
  is_datetime: boolean(),
  is_boolean: boolean(),
  is_integer: boolean(),
  is_float: boolean(),
  is_text: boolean(),
  max_data_length: non_neg_integer()
}

Functions

@spec add_subscriber() :: :ok

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec get_state() :: Csv2sql.ProgressTracker.State.t() | nil
@spec init_files([Csv2sql.File.t()]) :: files_map()
@spec report_error(any()) :: :ok
@spec start_link(any()) :: {:ok, pid()}
@spec update_file(Csv2sql.File.t()) :: :ok
Link to this function

update_row_count(path, rows_inserted)

View Source
@spec update_row_count(String.t(), non_neg_integer()) :: :ok
Link to this function

update_validation_status(status)

View Source
@spec update_validation_status(:passed | :failed) :: :ok