Skip to content
/ pg Public

An Elixir script that reads a CSV file and returns it content in a list of structs representing each row

Notifications You must be signed in to change notification settings

claudeomosa/pg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PG

A program that takes a CSV file as input, and returns either a Customer record or an error for each row

iex Usage

  • Run mix deps.get to install dependencies
  • Run tests with mix test
  • The following example shows how to parse a CSV file, open iex with iex -S mix
  • You can also run h CustomerRecordParser.parse_csv_file in iex
{:ok, records} = CustomerRecordParser.parse_csv_file("test/fixtures/record.csv")
#=> {:ok,[
#=>   ok: %{
#=>     country_id: 2,
#=>     dob: ~D[1990-01-01],
#=>     name: "John Doe",
#=>     national_id: "123456789",
#=>     phone: "254722000000",
#=>     site_code: 772
#=>     },
#=>   ]
#=> }

HTTP

Endpoints

    GET /

    GET /pg/valid_records 

    GET /pg/with_invalid_records

About

An Elixir script that reads a CSV file and returns it content in a list of structs representing each row

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages