Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
knqiufan committed Sep 21, 2024
2 parents 6047888 + 21f1043 commit 93f8b22
Show file tree
Hide file tree
Showing 39 changed files with 1,107 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
git clone https://github.com/vesoft-inc/nebula-docker-compose.git
pushd nebula-docker-compose/
cp ../../src/test/resources/docker-compose.yaml .
docker-compose up -d
docker compose up -d
sleep 30
docker-compose ps
docker compose ps
popd
popd
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
git clone https://github.com/vesoft-inc/nebula-docker-compose.git
pushd nebula-docker-compose/
cp ../../src/test/resources/docker-compose.yaml .
docker-compose up -d
docker compose up -d
sleep 30
docker-compose ps
docker compose ps
popd
popd
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
git clone https://github.com/vesoft-inc/nebula-docker-compose.git
pushd nebula-docker-compose/
cp ../../src/test/resources/docker-compose.yaml .
docker-compose up -d
docker compose up -d
sleep 30
docker-compose ps
docker compose ps
popd
popd
Expand Down
81 changes: 80 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,91 @@ This source code is licensed under Apache 2.0 License.

# NEXT

# 1.3.0

## Dependencies upgrade

- nebula-java: 3.6.0 -> 3.8.3
- org.hibernate:hibernate-core was excluded.
> If you need to use hibernate-core, please add the dependency by yourself.
## Bugfix

- fix: when `use-session-pool` and spaceFromParam is true, skip the space addition.
- fix: when timezone is not default, the time is incorrect.
- fix: allow normal startup without any mapper files.
- fix: Limit the node type obtained by `selectById` to the entity class of the interface.
- fix: When a node has multiple tags, prioritize using the tag of `resultType`. (Collaborate with [charle004](https://github.com/charle004), [#311](https://github.com/nebula-contrib/ngbatis/pull/311))
- fix: debugging log output issue [#312](https://github.com/nebula-contrib/ngbatis/issues/312)

## Feature

- feat: support the use of ciphertext passwords in yml.
- feat: expanding the `insertSelectiveBatch` interface in `NebulaDaoBasic`.
- feat: expanding the `insertSelectiveBatch` interface in `NebulaDaoBasic`.([#299](https://github.com/nebula-contrib/ngbatis/pull/299), via [Ozjq](https://github.com/Ozjq))
- feat: expanding the `shortestOptionalPath` interface in `NebulaDaoBasic`.([#303](https://github.com/nebula-contrib/ngbatis/pull/303), via [xYLiu](https://github.com/n3A87))
- feat: expanding the `showSpaces` interface in `NebulaDaoBasic`.([#304](https://github.com/nebula-contrib/ngbatis/pull/304), via [xYLiu](https://github.com/n3A87))
- feat: support ssl and http2 config in yml.
> http2 属于企业版的数据库才支持,但我没有测试环境,所以不确定是否可用。
> http2 is supported by the enterprise version of the database, but I don't have a test environment, so I'm not sure if it works.
- feat: support adding ID attributes of start and end nodes in edge entities.
> 通过 @DstId, @SrcId 进行注解,可以将属性标记成特殊的属性,用于查询时可以填充的起始点和终点的id值。
- example:

```yaml
nebula:
pool-config:
enable-ssl: true
ssl-param:
sign-mode: SELF_SIGNED
crt-file-path: /path/to/client.crt
key-file-path: /path/to/client.key
password: password
# ssl-param:
# sign-mode: CA_SIGNED
# ca-crt-file-path: /path/to/ca-client.crt
# crt-file-path: /path/to/client.crt
# key-file-path: /path/to/client.key
use-http2: false
custom-headers:
Route-Tag: abc
```
- feat: @Space annotation supports dynamic configuration.
> @Space 注解的 name 属性值可通过 spring 配置文件自定义配置。
- example:
```yaml
app:
person:
space: PERSON_SPACE
```
```java
@Space(name = "${nebula.space}")
@Table(name = "person")
public class Person {
@Id
private String vid;
private String name;

public String getVid() {
return vid;
}

public void setVid(String vid) {
this.vid = vid;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
```

# 1.2.2

Expand Down
6 changes: 4 additions & 2 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ This source code is licensed under Apache 2.0 License.

NgBatis | nebula-java | JDK | Springboot | Beetl
---|-------------|---|------------|---
1.3.0 | 3.8.3 | 8 | 2.7.0 | 3.15.10.RELEASE
1.3.0-jdk17 | 3.8.3 | 17 | 3.0.7 | 3.15.10.RELEASE
1.2.2 | 3.6.0 | 8 | 2.7.0 | 3.15.10.RELEASE
1.2.2-jdk17 | 3.6.0 | 17 | 3.0.7 | 3.15.10.RELEASE
1.2.1 | 3.6.0 | 8 | 2.7.0 | 3.15.10.RELEASE
Expand Down Expand Up @@ -62,14 +64,14 @@ This source code is licensed under Apache 2.0 License.
<dependency>
<groupId>org.nebula-contrib</groupId>
<artifactId>ngbatis</artifactId>
<version>1.2.2</version>
<version>1.3.0</version>
</dependency>
```

- Gradle

```groovy
implementation 'org.nebula-contrib:ngbatis:1.2.2'
implementation 'org.nebula-contrib:ngbatis:1.3.0'
```

### 参考 [【ngbatis-demo】](./ngbatis-demo),与springboot无缝集成。在该项目的 test 中还有api的样例。在开发过程中每增加一个特性也都会同步更新ngbatis-demo的用例
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ See [EXECUTION-PROCESS.md](./EXECUTION-PROCESS.md)

NgBatis | nebula-java | JDK | Springboot | Beetl
---|-------------|---|------------|---
1.3.0 | 3.8.3 | 8 | 2.7.0 | 3.15.10.RELEASE
1.3.0-jdk17 | 3.8.3 | 17 | 3.0.7 | 3.15.10.RELEASE
1.2.2 | 3.6.0 | 8 | 2.7.0 | 3.15.10.RELEASE
1.2.2-jdk17 | 3.6.0 | 17 | 3.0.7 | 3.15.10.RELEASE
1.2.1 | 3.6.0 | 8 | 2.7.0 | 3.15.10.RELEASE
1.2.0-jdk17 | 3.6.0 | 17 | 3.0.7 | 3.15.10.RELEASE
1.2.0 | 3.6.0 | 8 | 2.7.0 | 3.15.10.RELEASE
1.1.5 | 3.5.0 | 8 | 2.7.0 | 3.1.8.RELEASE
1.1.4 | 3.5.0 | 8 | 2.7.0 | 3.1.8.RELEASE
1.1.3 | 3.5.0 | 8 | 2.7.0 | 3.1.8.RELEASE
1.1.2 | 3.4.0 | 8 | 2.7.0 | 3.1.8.RELEASE

### SNAPSHOT

Expand All @@ -64,14 +64,14 @@ See [EXECUTION-PROCESS.md](./EXECUTION-PROCESS.md)
<dependency>
<groupId>org.nebula-contrib</groupId>
<artifactId>ngbatis</artifactId>
<version>1.2.2</version>
<version>1.3.0</version>
</dependency>
```

- Gradle

```groovy
implementation 'org.nebula-contrib:ngbatis:1.2.2'
implementation 'org.nebula-contrib:ngbatis:1.3.0'
```

- Referring to [ngbatis-demo](./ngbatis-demo), which was smoothly integrated with spring-boot. The API examples could be found under the test of it for all features of ngbatis.
Expand Down
66 changes: 66 additions & 0 deletions examples/kg-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<artifactId>kg-api</artifactId>
<packaging>jar</packaging>

<name>kg-api</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>


<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.nebula-contrib</groupId>
<artifactId>ngbatis</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>

</project>
22 changes: 22 additions & 0 deletions examples/kg-api/src/main/java/org/nebula/contrib/kg/KgApiApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.nebula.contrib.kg;

// Copyright (c) 2024 All project authors. All rights reserved.
//
// This source code is licensed under Apache 2.0 License.

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

/**
* Hello world!
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class},
scanBasePackages = {"org.nebula.contrib", "org.nebula.contrib.kg"})
public class KgApiApp {

public static void main(String[] args) {
SpringApplication app = new SpringApplication(KgApiApp.class);
app.run(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.nebula.contrib.kg.controller;

// Copyright (c) 2024 All project authors. All rights reserved.
//
// This source code is licensed under Apache 2.0 License.

import java.util.List;
import org.nebula.contrib.kg.pojo.Triplet;
import org.nebula.contrib.kg.service.DataService;
import org.nebula.contrib.kg.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @author yeweicheng
* @since 2024-09-02 15:46
* <br>Now is history!
*/
@RestController
@RequestMapping("/kg/data")
public class DataController {

@Autowired
private DataService service;

@RequestMapping("next")
public R<List<Triplet<String>>> next(String id) {
return R.ok(service.next(id));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.nebula.contrib.kg.controller;

// Copyright (c) 2024 All project authors. All rights reserved.
//
// This source code is licensed under Apache 2.0 License.

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @author yeweicheng
* @since 2024-09-02 15:46
* <br>Now is history!
*/
@RestController
@RequestMapping("/kg/schema")
public class SchemaController {

// TODO

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.nebula.contrib.kg.dao;

// Copyright (c) 2024 All project authors. All rights reserved.
//
// This source code is licensed under Apache 2.0 License.

import java.util.List;
import org.nebula.contrib.kg.pojo.Triplet;
import org.springframework.data.repository.query.Param;

/**
* @author yeweicheng
* @since 2024-09-02 15:54
* <br>Now is history!
*/
public interface DataDao<T> {

List<Triplet<T>> selectTriplets(@Param("id") T id);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.nebula.contrib.kg.ngbatis;

// Copyright (c) 2024 All project authors. All rights reserved.
//
// This source code is licensed under Apache 2.0 License.

import com.vesoft.nebula.client.graph.data.ResultSet;
import java.util.Collection;
import org.nebula.contrib.kg.pojo.Triplet;
import org.nebula.contrib.ngbatis.handler.AbstractResultHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
* @author yeweicheng
* @since 2024-08-28 13:59
* <br>Now is history!
*/
@Component
public class CollectionTripletResultHandler extends
AbstractResultHandler<Collection, Triplet<String>> {

@Autowired
private TripletResultHandler singleHandler;

@Override
public Collection handle(Collection newResult, ResultSet result, Class resultType)
throws NoSuchFieldException, IllegalAccessException, InstantiationException {

int rowsSize = result.rowsSize();
for (int i = 0; i < rowsSize; i++) {
ResultSet.Record row = result.rowValues(i);
Triplet<String> triplet = new Triplet<>();
triplet = singleHandler.handle(triplet, row);
newResult.add(triplet);
}
return newResult;
}

}
Loading

0 comments on commit 93f8b22

Please sign in to comment.