2021-10-15 12:38:06 +03:00

29 lines
462 B
Go

package statuskeycardgo
import "C"
import (
"encoding/hex"
"encoding/json"
)
func retValue(pairs ...interface{}) *C.char {
obj := make(map[string]interface{})
for i := 0; i < len(pairs)/2; i++ {
key := pairs[i*2]
value := pairs[(i*2)+1]
obj[key.(string)] = value
}
b, err := json.Marshal(obj)
if err != nil {
return C.CString(err.Error())
}
return C.CString(string(b))
}
func tox(bytes []byte) string {
return hex.EncodeToString(bytes)
}