Skip to content

Instantly share code, notes, and snippets.

@hassy
Created October 24, 2009 16:53
Show Gist options
  • Select an option

  • Save hassy/217624 to your computer and use it in GitHub Desktop.

Select an option

Save hassy/217624 to your computer and use it in GitHub Desktop.
// Start with an empty db.
URL with("http://localhost:8080/?action=select&op=pairs") fetch
// ==> []
URL with("http://localhost:8080/dir1?action=mkdir") fetch
URL with("http://localhost:8080/dir1/?action=write&key=k1") post("k1_val")
URL with("http://localhost:8080/?action=select&op=pairs") fetch
// ==> [["dir1",{"k1":"k1_val"}]]
// Now create a key and an empty container
URL with("http://localhost:8080/?action=write&key=k") post("k_val")
URL with("http://localhost:8080/?action=select&op=pairs") fetch
// ==> [["dir1",{"k1":"k1_val"}],["k",{}]]
URL with("http://localhost:8080/?action=read&key=k") fetch
// ==> "k_val"
URL with("http://localhost:8080/dir2?action=mkdir") fetch
// Can't tell the difference between a key and an empty container:
URL with("http://localhost:8080/?action=select&op=pairs") fetch
// ==> [["dir1",{"k1":"k1_val"}],["dir2",{}],["k",{}]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment