Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(s string, v interface{})
Decode will convert a base64 encoded string into bytes to decode into the value passed in the parameters using the gob decoder
Example ¶
encoded := "Ov+BAwEBDUNvbXBsZXhTdHJ1Y3QB/4IAAQMBBE5hbWUBDAABA0FnZQEGAAEIQmlydGhkYXkB/4QAAAAQ/4MFAQEEVGltZQH/hAAAACX/ggENamVzc2UgbWljaGFlbAEdAQ8BAAAADp37yWMAAAAA//8A" var v ComplexStruct Decode(encoded, &v) fmt.Printf("%v", v)
Output: {jesse michael 29 1990-06-04 03:15:47 +0000 UTC}
func Encode ¶
func Encode(v interface{}) string
Encode will convert the passed in value to a []byte using the gob encoder and base64 encode the bytes
Example ¶
t, _ := time.ParseInLocation(time.RFC3339, "1990-06-04T03:15:47.000Z", time.UTC) v := ComplexStruct{ Name: "jesse michael", Age: 29, Birthday: t, } encoded := Encode(&v) fmt.Println(encoded)
Output: Ov+BAwEBDUNvbXBsZXhTdHJ1Y3QB/4IAAQMBBE5hbWUBDAABA0FnZQEGAAEIQmlydGhkYXkB/4QAAAAQ/4MFAQEEVGltZQH/hAAAACX/ggENamVzc2UgbWljaGFlbAEdAQ8BAAAADp37yWMAAAAA//8A
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.