我正在尝试为我的Aerospike数据库创建一个查询,这将返回特定bin中的最高值;类似MAX()函数在MySQL中的工作方式。例如,如果我有这样的一套:Aerospike查询返回最高值
+--------------+---------+
| filename | version |
+--------------+---------+
| alphabet.doc | 4 |
| people.doc | 2 |
| alphabet.doc | 6 |
| people.doc | 3 |
+--------------+---------+
我需要的是只返回文件名与最高版本号。目前我可以添加一个像这样的过滤器:
stmt := db.NewStatement(DBns, DBset, "filename", "version")
stmt.Addfilter(db.NewEqualFilter("filename", "alphabet.doc"))
// run database query
records := runQuery(stmt)
任何人都知道如何做到这一点?
我不知道Aerospike,但快速查看文档指出了UDF(用户定义函数)。 http://www.aerospike.com/docs/client/go/usage/query/query_udf.html – jnmoal