Skip to content

Commit

Permalink
add go client for v2.0.0-beta (#41)
Browse files Browse the repository at this point in the history
* add go client for v2.0.0-beta

* refactor string()

* fix comments
  • Loading branch information
Aiee authored Dec 2, 2020
1 parent 805846e commit 832a994
Show file tree
Hide file tree
Showing 53 changed files with 37,947 additions and 88,704 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/build.yaml

This file was deleted.

54 changes: 23 additions & 31 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
name: test
on:
schedule:
- cron: '0 23 * * *'
pull_request:
paths-ignore:
- '.gitignore'
- 'README.md'
push:
paths-ignore:
- '.gitignore'
- 'README.md'
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-18.04
go-client:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: checkout nebula-go
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Setup nebula
run: |
git clone https://github.com/vesoft-inc/nebula-docker-compose.git
cd nebula-docker-compose/
docker-compose pull
docker-compose up -d
sleep 5
- name: test nebual-go
run: |
go test -v
- uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v1
with:
go-version: '1.13'
- name: Test with GO test
run: |
mkdir tmp
pushd tmp
git clone -b v2-preview https://github.com/vesoft-inc/nebula-docker-compose.git
pushd nebula-docker-compose/
sed -i '0,/\- 3699/s/\- 3699/\- "3710:3699"/' docker-compose.yaml
sed -i '0,/\- 3699/s/\- 3699/\- "3701:3699"/' docker-compose.yaml
docker-compose up -d
sleep 10
popd
popd
go test -v -race
46 changes: 8 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# nebula-go

![build status](https://github.com/vesoft-inc/nebula-go/workflows/build/badge.svg)
![test status](https://github.com/vesoft-inc/nebula-go/workflows/test/badge.svg)

**IMPORTANT: Code of Nebula go client has been transfred from [nebula-clients](https://github.com/vesoft-inc/nebula-clients) to this reposotory(nebula-go), and new realeases in the future will be published in this reposotory.
Please update your go.mod and imports corresspondingly.**

Official Nebula Go client which communicates with the server using [fbthrift](https://github.com/facebook/fbthrift/).

Please be careful do not to modify the files in the graph directory, these codes were all generated by fbthrift.

Currently the **Master branch** code is compatiple with Nebula v2.0.0 beta.
If you are using a older version, please check **branch v1.0.0**.

Please be careful do not to modify the files in the nebula directory, these codes were all generated by fbthrift.
## Install

```shell
Expand All @@ -17,37 +17,7 @@ If you get a message like `cannot use path@version syntax in GOPATH mode`, see t

## Usage example

```go
package main

import (
"log"

nebula "github.com/vesoft-inc/nebula-go"
graph "github.com/vesoft-inc/nebula-go/nebula/graph"
)

func main() {
client, err := nebula.NewClient("127.0.0.1:3699")
if err != nil {
log.Fatal(err)
}

if err = client.Connect("username", "password"); err != nil {
log.Fatal(err)
}
defer client.Disconnect()

resp, err := client.Execute("SHOW HOSTS;")
if err != nil {
log.Fatal(err)
}

if nebula.IsError(resp) {
log.Printf("ErrorCode: %v, ErrorMsg: %s", resp.GetErrorCode(), resp.GetErrorMsg())
}
}
```
[Code Example](https://github.com/vesoft-inc/nebula-clients/tree/master/go/example/graph_client_example.go)

## Enabling go modules

Expand Down
108 changes: 0 additions & 108 deletions client.go

This file was deleted.

Loading

0 comments on commit 832a994

Please sign in to comment.