ostafen / clover

A lightweight document-oriented NoSQL database written in pure Golang.
MIT License
666 stars 55 forks source link

Implement slice indexing when accessing a field #51

Open ostafen opened 2 years ago

ostafen commented 2 years ago

Hi, all. Currently, clover allows to access nested document fields by the following syntax:

doc.Get("field1.field2.field3")

Now, suppose that field2 is a slice. It would be useful to support indexing elements by the following syntax:

doc.Get("field1.field2.4.field3") // here, we are trying to access the fifth element of "field2"
jinzhongjia commented 2 years ago

hi, bro. i think you can release current version ,because the latest version not match the README

ostafen commented 2 years ago

v1.2.0 has been released :=)

DaniloMarques1 commented 2 years ago

Hello! I would like to work on it.

Just a quick question: doc.Get("field1.field2.2") assuming field2 is a slice the correct result would be to return the second element of field2?

ostafen commented 2 years ago

Yes, that's right