As Redis only stores strings I would like to know how I can do the equivalent of Javascript's JSON.stringify using Go to convert a Struct into a string.
I have tried typecasting:
string(the_struct)
but this results in an error.
As Redis only stores strings I would like to know how I can do the equivalent of Javascript's JSON.stringify using Go to convert a Struct into a string.
I have tried typecasting:
string(the_struct)
but this results in an error.
由于Redis仅存储字符串,我想知道如何使用Go to做相当于Javascript的JSON.stringify的操作 将结构转换为字符串。 p>
我尝试过类型转换: p>
string(the_struct)
code> pre >
,但这会导致错误。 p>
div>