fsdb v0.2.1 Fsdb
API module.
Standard API
:ok = Fsdb.create("table1")
{1, "row1"} = Fsdb.insert("table1", "row1")
{1, "row1+"} = Fsdb.update("table1", 1, "row1+")
{1, "row1+"} = Fsdb.fetch("table1", 1)
{1, "row1+"} = Fsdb.delete("table1", 1)
{:not_found, "table1", 1} = Fsdb.fetch("table1", 1)
[] = Fsdb.list("table1")
#bypass the id generator
{2, "row2"} = Fsdb.save("table1", 2, "row2")
{3, "row3"} = Fsdb.save("table1", 3, "row3")
#FIXME tuples may not be ID ordered
[{2, "row2"}, {3, "row3"}] = Fsdb.list("table1")
:ok = Fsdb.drop("table1")
Extended API
path = Path.expand("~/.fsdb")
{:ok, pid} = Fsdb.Server.start_link([path: path])
:ok = Fsdb.create(pid, "table1")
{1, "row1"} = Fsdb.insert(pid, "table1", "row1")
{1, "row1+"} = Fsdb.update(pid, "table1", 1, "row1+")
{1, "row1+"} = Fsdb.fetch(pid, "table1", 1)
{1, "row1+"} = Fsdb.delete(pid, "table1", 1)
{:not_found, "table1", 1} = Fsdb.fetch(pid, "table1", 1)
[] = Fsdb.list(pid, "table1")
#bypass the id generator
{2, "row2"} = Fsdb.save(pid, "table1", 2, "row2")
{3, "row3"} = Fsdb.save(pid, "table1", 3, "row3")
#FIXME tuples may not be ID ordered
[{2, "row2"}, {3, "row3"}] = Fsdb.list(pid, "table1")
:ok = Fsdb.drop(pid, "table1")
:ok = Fsdb.Server.stop(pid)
Summary
Functions
Creates a table with name table
Same as above but addresses an specific Fsdb.Server
Deletes the row in table table
having the id id
Same as above but addresses an specific Fsdb.Server
Drops the table named table
Same as above but addresses an specific Fsdb.Server
Fetches the row in table table
having the id id
Same as above but addresses an specific Fsdb.Server
Inserts row row
in table table
with auto generated ID
Same as above but addresses an specific Fsdb.Server
Returns all rows in table table
Same as above but addresses an specific Fsdb.Server
Inserts or updates row row
in table table
with specific id id
Same as above but addresses an specific Fsdb.Server
Updates the row in table table
having the id id
Same as above but addresses an specific Fsdb.Server
Functions
Same as above but addresses an specific Fsdb.Server.
pid
can be either a pid or a registered name.
Deletes the row in table table
having the id id
.
Returns {id, row} | {:not_found, table, id}
.
Same as above but addresses an specific Fsdb.Server.
pid
can be either a pid or a registered name.
Same as above but addresses an specific Fsdb.Server.
pid
can be either a pid or a registered name.
Fetches the row in table table
having the id id
.
Returns {id, row} | {:not_found, table, id}
.
Same as above but addresses an specific Fsdb.Server.
pid
can be either a pid or a registered name.
Same as above but addresses an specific Fsdb.Server.
pid
can be either a pid or a registered name.
Same as above but addresses an specific Fsdb.Server.
pid
can be either a pid or a registered name.
Inserts or updates row row
in table table
with specific id id
.
Returns {id, row}
.
Same as above but addresses an specific Fsdb.Server.
pid
can be either a pid or a registered name.
Updates the row in table table
having the id id
.
Returns {id, row} | {:not_found, table, id}
.