Skip to content

Instantly share code, notes, and snippets.

@jbowles
Last active December 29, 2015 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbowles/7714619 to your computer and use it in GitHub Desktop.
Save jbowles/7714619 to your computer and use it in GitHub Desktop.
gobike MStatus struct using with megajson experiment
package gobike
/*
Example JSON:
{
"HTTPStatus":200,
"TimeLocal":"2013-11-29T18:43:59.674946633-07:00",
"TimeUTC":"2013-11-30T01:43:59.674946695Z",
"URL":{
"Scheme":"",
"Opaque":"",
"User":null,
"Host":"",
"Path":"/",
"RawQuery":"",
"Fragment":""
},
"CacheTimeoutVal":1000000000,
"MemcacheError":null
}
NOTE: If I get rid of the 'URL' and 'MemcacheError' fields, AND change my memcache API to NOT RETURN THE FIELDS then all thigs work
by simply passing the http response body to the decoder.
*/
type MStatus struct {
HTTPStatus int
TimeLocal string
TimeUTC string
URL *URL_info
CacheTimeoutVal int
}
type URL_info struct {
Scheme string
Opaque string
Host string
Path string
RawQuery string
Fragment string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment