[ARVADOS] created: 0bb834af65ea679d03bfe6c4e578e3d3403b8bf8
git at public.curoverse.com
git at public.curoverse.com
Mon Sep 8 18:55:18 EDT 2014
at 0bb834af65ea679d03bfe6c4e578e3d3403b8bf8 (commit)
commit 0bb834af65ea679d03bfe6c4e578e3d3403b8bf8
Author: mishaz <misha at curoverse.com>
Date: Mon Sep 8 22:53:25 2014 +0000
Added to Go SDK documentation:
* Added link to instuctions on how to develop with bleeding edge client code.
* Fixed type error in documentation.
* Added instructions on how to view all returned fields with a map.
diff --git a/doc/sdk/go/index.html.textile.liquid b/doc/sdk/go/index.html.textile.liquid
index 0e26369..6996a4e 100644
--- a/doc/sdk/go/index.html.textile.liquid
+++ b/doc/sdk/go/index.html.textile.liquid
@@ -20,6 +20,8 @@ You don't need to install anything. Just import the client like this. The go too
</code></pre>
</notextile>
+If you need pre-release client code, you can use the latest version from the repo by following "these instructions.":https://arvados.org/projects/arvados/wiki/Go#Using-Go-with-Arvados
+
h3. Examples
Import the module. (We import the log module here too, so we can use it in the subsequent examples.)
@@ -47,8 +49,8 @@ Get the User object for the current user:
<notextile>
<pre><code class="userinput"> type user struct {
- Uuid string `json:"uuid"`
- FullName int `json:"full_name"`
+ Uuid string `json:"uuid"`
+ FullName string `json:"full_name"`
}
var u user
@@ -62,4 +64,37 @@ Get the User object for the current user:
</code></pre>
</notextile>
+Print all returned fields for collections:
+
+<notextile>
+<pre><code class="userinput"> var collections map[string]interface{}
+
+ params := arvadosclient.Dict{"limit": 10}
+
+ err = arv.Call("GET", "collections", "", "", params, &collections)
+ if err != nil {
+ log.Fatalf("error querying collections", err.Error())
+ }
+
+ for key, value := range collections {
+ if key == "items" {
+ items := value.([]interface{})
+ for index, item := range items {
+ fmt.Println("=========== ", index, " ===========")
+ item_map := item.(map[string]interface{})
+ if len(item_map) == 0 {
+ fmt.Println("item", index, ": empty map")
+ } else {
+ for k,v := range item_map {
+ fmt.Println(index, k, ":", v)
+ }
+ }
+ }
+ } else {
+ fmt.Println(key, ":", value)
+ }
+ }
+</code></pre>
+</notextile>
+
A few more usage examples can be found in the services/keepproxy and sdk/go/keepclient directories in the arvados source tree.
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list