-
Notifications
You must be signed in to change notification settings - Fork 0
/
params.json
1 lines (1 loc) · 2.56 KB
/
params.json
1
{"name":"Erldb","tagline":"ORM implementation in Erlang","body":"# Erl_DB\r\nORM (Object-relational mapping) application implemented in Erlang.\r\n\r\n# Model files\r\nCheck 'testmodel.model' in the examples/ directory\r\n\r\n#Usage:\r\n\r\nThis is the example model that is in examples directory:\r\n\r\n import: users, tags\r\n\r\n name: blog_entry\r\n backend: mnesia\r\n\r\n /* This is a test comment */\r\n\r\n fields:\r\n id :: primary_key(auto_increment)\r\n title :: string(max_length = 255, index)\r\n author :: string(max_length = 100)\r\n created :: datetime()\r\n text :: string()\r\n\r\n\r\nTo get your workers they are stored as deps in rebar.config in our config we have a mnesia worker.\r\n\r\n {erl_db_mnesia, \",*\", {git, \"[email protected]:Taure/erl_db_mnesia.git\", \"master\"}}\r\n\r\nThis is a worker that help us to do basic things with mnesia to get it use:\r\n\r\n rebar get-deps\r\n\r\nTo compile your code and to compile your models.\r\n\r\n rebar compile model\r\n\r\nThen start a shell (I did it with erl -pa ebin -pa deps/*/ebin)\r\n\r\n Eshell V5.9.2 (abort with ^G)\r\n 1> application:start(erl_db).\r\n 21:41:44.883 [info] Application lager started on node nonode@nohost\r\n 21:41:44.951 [info] Application mnesia started on node nonode@nohost\r\n 21:41:44.951 [info] Application erl_db started on node nonode@nohost\r\n ok\r\n\r\nHere you will see that mnesia is started. It is started in the worker so now we know that the worker is loaded. (Maybe we should say something like a log message)\r\n\r\n 2> FirstEntry = blog_entry:new(id, \"My title\", \"Mr Imsobad\", now(), \"This is my first blog entry. And it is stored in mnesia. Hope I don't forget that\").\r\n {blog_entry,id,\"My title\",\"Mr Imsobad\",\r\n {1361,393556,541209},\r\n \"This is my first blog entry. And it is stored in mnesia. Hope I don't forget that\"}\r\n\r\nThis is our first entry in our blog, now we will try to store it.\r\n\r\n 3> erl_db:create_table(blog_entry).\r\n {atomic,ok}\r\n 4> erl_db:save(FirstEntry).\r\n {atomic,ok}\r\n 5> erl_db:find(blog_entry, 1).\r\n {atomic,[{blog_entry,1,\"My title\",\"Mr Imsobad\",\r\n {1361,469740,519505},\r\n \"This is my first blog entry. And it is stored in mnesia. Hope I don't forget that\"}]}\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}