Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/secretworry/csvto
Convert csv file to elixir map with ease
https://github.com/secretworry/csvto
csv elixir
Last synced: 3 months ago
JSON representation
Convert csv file to elixir map with ease
- Host: GitHub
- URL: https://github.com/secretworry/csvto
- Owner: secretworry
- License: mit
- Created: 2016-12-25T07:12:02.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-27T10:36:27.000Z (over 6 years ago)
- Last Synced: 2024-10-11T20:14:53.397Z (3 months ago)
- Topics: csv, elixir
- Language: Elixir
- Size: 46.9 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Csvto
**Convert csv file to elixir map with ease**
## Installation
Add csvto to your list of dependencies in `mix.exs`
```
# use the stable version
def deps do
[{:csvto, "~> 0.1.3"}]
end# use the latest version
def deps do
[{:csvto, github: "secretworry/csvto.git", branch: :master}]
end# start csvto
defp application do
[applications: [:csvto]]
end
```## Quick Example
```elixir
defmodule MyCsvto do
use Csvto.Buildercsv "product" do
field :name, :string, name: "Name"
field :number, :string, name: "Number"
field :description, :string, name: "Desc"
field :price, :float, name: "Price", validate: &(&1 >= 0)
field :images, {:array, :string}, name: "Images", separator: "|"
end
endMyCsvto.from(path, :product) # returns [Map.t]
```## Documentation
You can read more from our [Hexdocs](https://hexdocs.pm/csvto/api-reference.html)
* Types that support can be found [here](https://hexdocs.pm/csvto/Csvto.Builder.html)