[go client] how to generate a *api.Value with dateime Val

I notice tha *api.Value_DatetimeVal receive a []byte value,but I dont know how to convert the time.Time to the []byte that can match the rpc require.

It always give below error to me :

 `rpc error: code = Unknown desc = strconv.ParseUint: parsing \"<invalid Value>\": invalid syntax"`

here is my request json:


all of the case below are not work,is return‘s the same error:
case 1:

func nqTimeVal(val time.Time) *api.Value {
	return &api.Value{Val: &api.Value_DatetimeVal{DatetimeVal: []byte(val.String())}}

case 2:

func nqTimeVal(val time.Time) *api.Value {
	b,_ :=val.MarshalBinary()
	return &api.Value{Val: &api.Value_DatetimeVal{DatetimeVal: b}}

case 3:

func nqTimeVal(val time.Time) *api.Value {
	var buf = make([]byte, 8)
	binary.BigEndian.PutUint64(buf, uint64(val.Unix()))
	return &api.Value{Val: &api.Value_DatetimeVal{DatetimeVal: buf}}

case 4:

func nqTimeVal(val time.Time) *api.Value {
	s := strconv.Itoa(int(val.Unix()))
	return &api.Value{Val: &api.Value_DatetimeVal{DatetimeVal: []byte(s)}}

So, what is the correct way to set DatetimeVal

From looking at the code, both time.Time.MarshalBinary() and time.Time.MarshalText() should work