Skip to content

tradingAI/nebula-go

 
 

Repository files navigation

nebula-go

build status

Official Nebula Go client which communicates with the server using fbthrift.

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

Install

$ go get -u -v github.com/vesoft-inc/nebula-go

Usage example

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 resp.GetErrorCode() != graph.ErrorCode_SUCCEEDED {
    log.Printf("ErrorCode: %v, ErrorMsg: %s", resp.GetErrorCode(), resp.GetErrorMsg())
  }
  
}

Packages

No packages published

Languages

  • Go 100.0%