Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8ce8b2b
fix(hubble): build with node and yarn (#543)
liuxiaocs7 Dec 6, 2023
d59669d
feat: support edgeexistence api
msgui Nov 13, 2023
c3e2a7b
chore
msgui Nov 30, 2023
d489507
add new version api
msgui Nov 30, 2023
780981d
fix: sortValues -> sort_values
msgui Nov 30, 2023
7cebd5e
update commit_id
msgui Dec 3, 2023
f8098a3
fix: module dir
msgui Dec 3, 2023
324055a
chore
msgui Dec 4, 2023
e57f62e
fix
msgui Dec 4, 2023
a68ca8f
revert commit ID & let it pass 100
imbajin Dec 4, 2023
3a822ac
fix
msgui Dec 5, 2023
1fabba7
Revert "fix"
msgui Dec 5, 2023
86445e3
Revert "fix: module dir"
msgui Dec 5, 2023
ab81f9b
fix
msgui Dec 7, 2023
72df58c
fix
msgui Dec 9, 2023
58b5112
update the commit_id latest
msgui Dec 9, 2023
ed9725e
Revert "Revert "fix: module dir""
msgui Dec 9, 2023
c677b1c
Revert "Revert "fix""
msgui Dec 9, 2023
c50ad36
fix
msgui Dec 9, 2023
1fdc4ef
fix hbase loader options (#548)
liuxiaocs7 Dec 9, 2023
d7c8bbe
chore(deps): bump async in /hugegraph-hubble/hubble-fe (#484)
dependabot[bot] Dec 11, 2023
155f4a3
chore(deps): bump semver in /hugegraph-hubble/hubble-fe (#491)
dependabot[bot] Dec 11, 2023
1bbb4a8
fix checkstyle and ref ci (#551)
liuxiaocs7 Dec 11, 2023
8133144
feature(client): support go client for hugegraph (#514)
izliang Dec 11, 2023
0e1caa0
refact(client): update tests for new OLTP traverser APIs (#550)
DanGuge Dec 12, 2023
3d9e2b4
Merge branch 'master' into pr/544
imbajin Dec 12, 2023
614bf4d
Update client-go-ci.yml
imbajin Dec 12, 2023
a639a1b
fix style & check version
imbajin Dec 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/client-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "hugegraph-client-ci"
name: "java-client-ci"

on:
workflow_dispatch:
Expand All @@ -25,7 +25,7 @@ jobs:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-client/assembly/travis
# TODO: replace it with the (latest - n) commit id (n >= 15)
COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314
COMMIT_ID: b52517c
strategy:
fail-fast: false
matrix:
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/client-go-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: "go-client-ci"

on:
push:
branches:
- master
- /^release-.*$/
paths:
- hugegraph-client-go/**
- hugegraph-dist/**
- .github/workflows/**
- pom.xml
pull_request:
paths:
- hugegraph-client-go/**
- hugegraph-dist/**
- .github/workflows/**
- pom.xml

jobs:
client-go-ci:
runs-on: ubuntu-latest
env:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-client/assembly/travis
# TODO: replace it with the (latest - n) commit id (n >= 15)
COMMIT_ID: b52517c
strategy:
fail-fast: false
matrix:
JAVA_VERSION: ['11']
steps:
- name: Install JDK 11
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'zulu'

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Use staged maven repo
if: ${{ env.USE_STAGE == 'true' }}
run: |
cp $HOME/.m2/settings.xml /tmp/settings.xml
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml

- name: Prepare env and service
run: |
$TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID

- name: Init Go env
uses: actions/setup-go@v2.1.3
with: { go-version: '1.x' }

- name: Go test
run: |
go version
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
cd hugegraph-client-go && make test
2 changes: 0 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ name: "CodeQL"

on:
workflow_dispatch:
push:
branches: [ master, release-* ]
pull_request:
# The branches below must be a subset of the branches above
# branches: [ master ] # enable in all PR
Expand Down
22 changes: 2 additions & 20 deletions .github/workflows/hubble-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "hugegraph-hubble-ci"
name: "hubble-ci"

on:
workflow_dispatch:
Expand All @@ -24,7 +24,7 @@ on:
env:
TRAVIS_DIR: hugegraph-hubble/hubble-dist/assembly/travis
# TODO: replace it with the (latest - n) commit id (n >= 15)
COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314
COMMIT_ID: b52517c

jobs:
hubble-ci:
Expand All @@ -38,10 +38,6 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
# we also should cache python & yarn & downloads to avoid useless work
- name: Cache Maven packages
uses: actions/cache@v3
Expand All @@ -51,20 +47,6 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-

- name: Get Yarn path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Yarn packages
uses: actions/cache@v3
# use id to check `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Cache Python packages
uses: actions/cache@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/loader-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "hugegraph-loader-ci"
name: "loader-ci"

on:
workflow_dispatch:
Expand Down Expand Up @@ -27,7 +27,7 @@ jobs:
TRAVIS_DIR: hugegraph-loader/assembly/travis
STATIC_DIR: hugegraph-loader/assembly/static
# TODO: replace it with the (latest - n) commit id (n >= 15)
COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314
COMMIT_ID: b52517c
DB_USER: root
DB_PASS: root
DB_DATABASE: load_test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spark-connector-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "hugegraph-spark-connector-ci"
name: "spark-connector-ci"

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
pull-requests: write

steps:
- uses: actions/stale@v3
- uses: actions/stale@v8
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tools-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "hugegraph-tools-ci"
name: "tools-ci"
on:
workflow_dispatch:
push:
Expand All @@ -25,7 +25,8 @@ jobs:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-tools/assembly/travis
# TODO: could we use one param to unify it? or use a action template (could use one ci file)
COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314
# TODO: replace it with the (latest - n) commit id (n >= 15)
COMMIT_ID: b52517c
steps:
- name: Install JDK 11
uses: actions/setup-java@v3
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ tree.txt

# system ignore
Thumbs.db

# client-go
go.env
3 changes: 3 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ header: # `header` section is configurations for source codes license header.
- 'assembly/**'
- '.github/**/*'
- '**/target/*'
- 'hugegraph-client-go/go.mod'
- 'hugegraph-client-go/go.sum'
- 'hugegraph-client-go/Makefile'
- 'hugegraph-client/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker'
# - 'hugegraph-hubble/hubble-fe/**'
comment: on-failure # on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`.
Expand Down
72 changes: 72 additions & 0 deletions hugegraph-client-go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# init project path
HOMEDIR := $(shell pwd)
OUTDIR := $(HOMEDIR)/output

# Get the go environment required for compilation
export GOENV = $(HOMEDIR)/go.env

GO := GO111MODULE=on go
GOPATH := $(shell $(GO) env GOPATH)
GOMOD := $(GO) mod
GOBUILD := $(GO) build
GOTEST := $(GO) test -race -timeout 30s -gcflags="-N -l"
GOPKGS := $$($(GO) list ./...| grep -vE "vendor")

# test cover files
COVPROF := $(HOMEDIR)/covprof.out # coverage profile
COVFUNC := $(HOMEDIR)/covfunc.txt # coverage profile information for each function
COVHTML := $(HOMEDIR)/covhtml.html # HTML representation of coverage profile

# make, make all
all: prepare compile package

set-env:
$(GO) env -w GO111MODULE=on


#make prepare, download dependencies
prepare: gomod

gomod: set-env
$(GOMOD) download

#make compile
compile: build

build:
$(GOBUILD) -o $(HOMEDIR)/hugegraph-client-go
# make test, test your code
test: prepare test-case
test-case:
$(GOTEST) -v -cover $(GOPKGS)

# make package
package: package-bin
package-bin:
rm -rf $(OUTDIR)
mkdir -p $(OUTDIR)
mv hugegraph-client-go $(OUTDIR)/
# make clean
clean:
$(GO) clean
rm -rf $(OUTDIR)
rm -rf $(GOPATH)/pkg/darwin_amd64
# avoid filename conflict and speed up build
.PHONY: all prepare compile test package clean build
96 changes: 96 additions & 0 deletions hugegraph-client-go/README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# go-hugegraph

#### Introduction

HugeGraph client SDK tool based on Go language

#### Software Architecture

Software Architecture Description

#### Installation Tutorial

```Shell

Go get github. com/go huggraph

```

#### Implement API

| API | illustrate |
|---------|-------------------------|
| schema | Obtain the model schema |
| version | Get version information |

#### Instructions for use

##### 1. Initialize the client

```Go
package main

import "github.com/apache/incubator-hugegraph-toolchain/hugegraph-client-go"
import "github.com/apache/incubator-hugegraph-toolchain/hugegraph-client-go/hgtransport"

func main() {

clinet, err := hugegraph.NewCommonClient(hugegraph.Config{
Host: "127.0.0.1",
Port: 8080,
Graph: "hugegraph",
Username: "",
Password: "",
Logger: &hgtransport.ColorLogger{
Output: os.Stdout,
EnableRequestBody: true,
EnableResponseBody: true,
},
})

if err != nil {
log.Fatalf("Error creating the client: %s\n", err)
}
}
```

##### 2. Obtain the hugegraph version

-1. Use the SDK to obtain version information

```Go
package main

import (
"fmt"
"log"
)

func getVersion() {

client := initClient()
res, err := client.Version()
if err != nil {
log.Fatalf("Error getting the response: %s\n", err)
}
defer res.Body.Close()

fmt.Println(res.Versions)
fmt.Println(res.Versions.Version)
}
```

-2. Result Set Response Body

```Go
package main

type VersionResponse struct {
Versions struct {
Version string `json:"version"` // hugegraph version
Core string `json:"core"` // hugegraph core version
Gremlin string `json:"gremlin"` // hugegraph gremlin version
API string `json:"api"` // hugegraph api version
} ` json: 'versions'`
}
```
Loading