Can int64 or []byte type be serialized with N1QL?

Hi!

I am trying to write a cb driver to a go library and have the following document in cb:

{
  "subject_id": "493",
  "subject_type": "User",
  "predicate": "Post",
  "object_id": "ctzbdgoU9h",
  "nano_ts": 1443728525107964700,
  "source": "493"
}

so nano_ts has a int64 type and there is also another document which has a []byte type field. Now i want to get that document based on a field but i am not able to serialize it back. My other ideas is to use META(bucket) and get the documetID instead and then Bulk/Multiget everything but i am not able to serialize that id neither with a simple struct and launch a query with select META().

type Idrow struct {
Id string `json:"id"`
}

Current code:

query := couchbase.NewN1qlQuery("SELECT subject_id,predicate,object_id,nano_ts,source                FROM activity as b WHERE subject_id='493'")

rows, err := users.ExecuteN1qlQuery(query, nil)

var row x.Instruction
for rows.Next(&row) {
 fmt.Printf("Row: %+v\n", row)
}
rows.Close()

Hey Lundin,
int64 is represented as a float64 when you query,
so x.Instruction should have a property called nano_ts float64.
You can check the response using cbq and see what comes back,
which in your case nano_ts is 1.4437285251079647e+18

regarding your byte array, i have no idea how you managed to fit one into a legit json ( an array of ints? ), but it will be better if you encode it to base64 and work with it as a string, at least this is what i would do.

Good luck!