How to fetch Couchbase n1ql fetched rows value in golang as similar to python

Can anyone please help me fetch records from n1ql query using GO same as comparing to python(ex :: row.id ,row.maxCAS ):

i referred this link also suggested in this forum but am not able to implement it properly ending up with some or the other error. (https://github.com/couchbaselabs/beersample-go/blob/1a64b11b3f7acf59564f052f59ad66b316632b45/beersample.go#L21)

```
In Python :
query = select meta().id,round((META().cas)/1000000000) as maxCAS,Expiretime from bucketname where Expiretime='10000';

recs = bucket.n1ql_query(N1QLQuery(query))
    for rec in recs:
        try:
            v_rec_count=v_rec_count+1
            print rec      //   {u'Expiretime': u'3600', u'id': u'userid,poc', u'maxCAS': 1591037838}
            key=rec['id'].strip()  // result : userid,poc
			key=rec['Expiretime'].strip()  // result: 3600
            print key
			
In Go:

myQuery := gocb.NewN1qlQuery(query)
rows, err := bucket.ExecuteN1qlQuery(myQuery, nil)
    for rows.Next(&row) {
       fmt.Printf("Row: %+v\n", row)  // map[Expiretime:3600 id:userid,poc maxCAS:1.591037838e+09]-->how can i fetch only id,expiretime,cas value as done in python 
    }
	
```

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.