This allows multiple Metrics to be stored in a map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -v -d '{"":"testvalue"}' -H "Content-Type: application/json" http://127.0.0.1:8098/buckets/test/keys?returnbody=true | |
* About to connect() to 127.0.0.1 port 8098 (#0) | |
* Trying 127.0.0.1... connected | |
> POST /buckets/test/keys?returnbody=true HTTP/1.1 | |
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 | |
> Host: 127.0.0.1:8098 | |
> Accept: */* | |
> Content-Type: application/json | |
> Content-Length: 16 | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (self *Client) Store(bucket string, returnBody bool, data *Data) (*Data, error) { | |
// check if the key exists for conditional put/post | |
path := "" | |
returnData := Data{} | |
resp := http.Response{} | |
// check if the key exists | |
if data.value == "" { | |
return &returnData, errors.New("RGO: no value defined for the key") | |
} | |
if data.key != "" { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"encoding/xml" | |
"net/http" | |
"errors" | |
) | |
type Answer struct { |
Structs can be printed using the builtin print methods as they take advantage of the reflect package.
Print a struct as is with %v
Print a struct with field names by %+v
Run the code here : http://play.golang.org/p/X8ke-0zPUT
{ "keys": ["super+shift+r"],
"command": "insert_snippet",
"args" : {
"contents": "app.get(\"/${1:}$SELECTION\", routes.${1:}$SELECTION);${0}"
}
}
Go to Sublime Text 2 > Preferences > Key Bindings - User
and add this JSON to the file:
[
{ "keys": ["super+shift+l"],
"command": "insert_snippet",
"args": {
"contents": "console.log(${1:}$SELECTION);${0}"
}
}