-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from CorvusYe/master
fix: support methods in mapper tags to set space to null.
- Loading branch information
Showing
6 changed files
with
106 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
ngbatis-demo/src/main/java/ye/weicheng/ngbatis/demo/repository/DropSpaceDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ye.weicheng.ngbatis.demo.repository; | ||
|
||
// Copyright (c) 2023 All project authors. All rights reserved. | ||
// | ||
// This source code is licensed under Apache 2.0 License. | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 方法中指定该语句不使用space,比如说 create space 等语句-DAO | ||
* @author yeweicheng | ||
* @since 2023-11-10 13:18 | ||
* <br>Now is history! | ||
*/ | ||
public interface DropSpaceDao { | ||
|
||
void createSpace(String name); | ||
|
||
void dropSpace(String name); | ||
|
||
List<String> showTags(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!-- | ||
Copyright (c) 2023 All project authors. All rights reserved. | ||
This source code is licensed under Apache 2.0 License. | ||
--> | ||
<mapper namespace="ye.weicheng.ngbatis.demo.repository.DropSpaceDao" space="test_drop"> | ||
|
||
<delete id="dropSpace"> | ||
drop space ${ p0 }; | ||
</delete> | ||
|
||
<select id="createSpace" space="null"> | ||
create space ${ p0 } ( vid_type = INT64 ); | ||
</select> | ||
|
||
<select id="showTags" resultType="java.lang.String"> | ||
SHOW TAGS; | ||
</select> | ||
|
||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
ngbatis-demo/src/test/java/ye/weicheng/ngbatis/demo/repository/DropSpaceDaoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package ye.weicheng.ngbatis.demo.repository; | ||
|
||
// Copyright (c) 2023 All project authors. All rights reserved. | ||
// | ||
// This source code is licensed under Apache 2.0 License. | ||
|
||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
/** | ||
* @author yeweicheng | ||
* @since 2023-11-10 13:26 | ||
* <br>Now is history! | ||
*/ | ||
@SpringBootTest | ||
class DropSpaceDaoTest { | ||
|
||
@Autowired | ||
private DropSpaceDao dao; | ||
|
||
@Test | ||
void dropSpace() throws InterruptedException { | ||
String spaceName = "test_drop"; | ||
dao.createSpace(spaceName); | ||
Thread.sleep(10 * 1000); | ||
|
||
List<String> tags = dao.showTags(); | ||
System.out.println(tags); | ||
|
||
dao.dropSpace(spaceName); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters