Comments (6)
@laura-ding Ok, I will then start the wrapped task.
from nebula-go.
Hi everyone, I have write a orm library support nebula write by go, now it's feature like this
- support insert Vertex/Edge use map or struct
- parse execute result to struct or map.
- will support chainable in the future
Now i am test it in we production, and it will be a Open Source Project in one or two weeks later.
There are some example:
// init
func main() {
dalector := norm.MustNewDialector(norm.DialectorConfig{
Addresses: []string{"127.0.0.1:9669"},
Timeout: time.Second * 5,
})
db := norm.MustOpen(dalector, norm.Config{
Space: "test",
Username: "test",
Password: "test",
})
run(db)
}
func insertVertex(db *norm.DB) {
user := &examples.User{
VModel: norm.VModel{
Vid: "user_101",
},
ID: 101,
Created: 101,
}
err := db.Debug().InsertVertex(user)
if err != nil {
log.Errorf(context.TODO(), "insert %+v error: %v", user, err)
panic(err)
}
}
func insertEdge(db *norm.DB) {
vote := &examples.AnswerVoteUp{
EModel: norm.EModel{
Src: "user_101",
Dst: "answer_102",
},
VoteUpCnt: 101,
Created: 100000,
}
err := db.Debug().InsertEdge(vote)
if err != nil {
log.Errorf(context.TODO(), "insert %+v error: %v", vote, err)
panic(err)
}
}
func matchSingle(db *norm.DB) {
nsql := "match(v:user) where id(v)=='user_101' return v.id as id,v.created as created"
user := examples.User{}
err := db.Debug().ExecuteAndParse(nsql, &user)
if err != nil {
log.Errorf(context.TODO(), "exec %s error: %v", nsql, err)
panic(err)
}
log.Infof(context.TODO(), "%+v", user)
}
(forgive my poor english
from nebula-go.
Thank you @Ranxy!
What do you think of this please? @Aiee @laura-ding
from nebula-go.
@Ranxy Thanks for your question. 'execute' applies to all NGQL's, and INSERT NGQL is just one. execute
is just a basic interface. The command splicing you want should be wrapped in another layer instead of being provided by execute
. Welcome to contribute such wrapper layer.
from nebula-go.
@laura-ding Ok, I will then start the wrapped task.
Thanks for your contribution.
from nebula-go.
@laura-ding Ok, I will then start the wrapped task.
Thank you @Ranxy!
from nebula-go.
Related Issues (20)
- when there's no properties, do not print empty {} HOT 1
- v3.4.1 session 泄露 HOT 3
- Some debug info of MakePlan is printed
- Failure recover for client side
- sessionPool使用的时候,session会一直增长? HOT 4
- support storage scan interface
- Support unit test outside
- `Space was not chosen` when connecting to LB in cloud with HTTP2 HOT 5
- What if user wants to pass in a `int64` as param? HOT 2
- Allow users to setHeader when using HTTP/2
- Need an interface to get the byte size of result set HOT 2
- Introduce LoadNebulaRow into the package HOT 4
- support to config the version white list
- 关于Value的处理 HOT 2
- `ResultSet.Scan` should support more types HOT 1
- Add more helper methods for session pool HOT 6
- Can we only support Go 1.18+ HOT 7
- Http2 example can not use HOT 5
- CreateTag and CreateEdge support `default`
- Connection pool: put conn to idle queue if auth responded with unsuccessful code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nebula-go.