Skip to content

JonGretar/DBFex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DBF

Read DBASE files in Elixir.

At the moment it only supports read.

Usage

Open a file with open/1 or open/2

{:ok, db} = DBF.open("test/dbf_files/bayarea_zipcodes.dbf")

The resulting DB follows the enumerable protocol, so you can use all the functions in the Enum module.

So to get all the records of a database you can do:

db |> Enum.to_list()

The result will be a tuple ´{status, %{...}}´ with the record status being either :record or :deleted_record.

You can get specific rows by using the DBF.get/2 function.

case DBF.get(db, 2) do
  {:record, row} -> IO.inspect row
  {:deleted_record, row} -> IO.inspect row
  {:error, _} -> IO.puts "OMG"
end

DBF File Format

About

Read DBASE dbf files in Elixir.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages