vesoft-inc / nebula-clients

API of Nebula Graph in different programming languages.
15 stars 7 forks source link

serialization/deserialization support for clients #42

Open kindlychung opened 3 years ago

kindlychung commented 3 years ago

Take one example from the go client:

            insertEdges := "INSERT EDGE like(likeness) VALUES " +
                "'Bob'->'Lily':(80.0), " +
                "'Bob'->'Tom':(70.0), " +
                "'Lily'->'Jerry':(84.0), " +
                "'Tom'->'Jerry':(68.3), " +
                "'Bob'->'John':(97.2);"

This looks like a lot of hassle with string manipulation, and nowadays developers expect something easier and more structured like:

type Player struct {
    id string `nebula: "vid"`
    name string `nebula:"name"`
    age  int `nebula:"age"`
}
player := Player{id: "player100", name: "Tim", age: 33}
nebulaClient.insert(player)
kindlychung commented 3 years ago

Here is how mongodb does it: https://github.com/mongodb/mongo-go-driver/tree/master/bson/bsoncodec