|
|
@@ -291,9 +291,11 @@ func InsertEntity[T any](executor Executor, tableName string, e T) error
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. tableName: 要操作的表名
|
|
|
-3. e: 实体,需要持久化的字段应该都赋值
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+tableName: 要操作的表名
|
|
|
+
|
|
|
+e: 实体,需要持久化的字段应该都赋值
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
@@ -307,9 +309,11 @@ func DeleteEntity[T any](executor Executor, tableName string, e T) error
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. tableName: 要操作的表名
|
|
|
-3. e: 实体,仅赋值key字段即可
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+tableName: 要操作的表名
|
|
|
+
|
|
|
+e: 实体,仅赋值key字段即可
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
@@ -323,9 +327,11 @@ func UpdateEntity[T any](executor Executor, tableName string, e T) error
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. tableName: 要操作的表名
|
|
|
-3. e: 实体,仅赋值key字段和需要更新的字段即可
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+tableName: 要操作的表名
|
|
|
+
|
|
|
+e: 实体,仅赋值key字段和需要更新的字段即可
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
@@ -348,8 +354,9 @@ VALUES
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. executeParams: 插入操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+executeParams: 插入操作需要的参数,如下所示
|
|
|
|
|
|
```go
|
|
|
type InsertExecuteParams struct {
|
|
|
@@ -381,8 +388,9 @@ WHERE
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. executeParams: 删除操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+executeParams: 删除操作需要的参数,如下所示
|
|
|
|
|
|
```go
|
|
|
type DeleteExecuteParams struct {
|
|
|
@@ -416,8 +424,9 @@ WHERE
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. executeParams: 更新操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+executeParams: 更新操作需要的参数,如下所示
|
|
|
|
|
|
```go
|
|
|
type UpdateExecuteParams struct {
|
|
|
@@ -456,8 +465,9 @@ WHERE
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. executeParams: 查询操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+executeParams: 查询操作需要的参数,如下所示
|
|
|
|
|
|
```go
|
|
|
type QueryExecuteParams struct {
|
|
|
@@ -473,9 +483,11 @@ Conditions可以通过sql_tpl中的NewConditions()函数创建,其中有各种
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
-1. 查询结果
|
|
|
-2. 总数
|
|
|
-3. 是否出现错误
|
|
|
+查询结果
|
|
|
+
|
|
|
+总数
|
|
|
+
|
|
|
+是否出现错误
|
|
|
|
|
|
```go
|
|
|
func QueryOne(executor Executor, executeParams *sql_tpl.QueryOneExecuteParams) (map[string]any, error)
|
|
|
@@ -485,8 +497,9 @@ func QueryOne(executor Executor, executeParams *sql_tpl.QueryOneExecuteParams) (
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. executeParams: 查询操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+executeParams: 查询操作需要的参数,如下所示
|
|
|
|
|
|
```go
|
|
|
type QueryOneExecuteParams struct {
|
|
|
@@ -500,8 +513,9 @@ Conditions可以通过sql_tpl中的NewConditions()函数创建,其中有各种
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
-1. 查询结果
|
|
|
-2. 是否出现错误
|
|
|
+查询结果
|
|
|
+
|
|
|
+是否出现错误
|
|
|
|
|
|
```go
|
|
|
func Count(executor Executor, executeParams *sql_tpl.CountExecuteParams) (int64, error)
|
|
|
@@ -522,8 +536,9 @@ WHERE
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. executeParams: 计数操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+executeParams: 计数操作需要的参数,如下所示
|
|
|
|
|
|
```go
|
|
|
type CountExecuteParams struct {
|
|
|
@@ -536,8 +551,9 @@ Conditions可以通过sql_tpl中的NewConditions()函数创建,其中有各种
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
-1. 计数结果
|
|
|
-2. 是否出现错误
|
|
|
+计数结果
|
|
|
+
|
|
|
+是否出现错误
|
|
|
|
|
|
```go
|
|
|
func CheckExist(executor Executor, executeParams *sql_tpl.CheckExistExecuteParams) (bool, error)
|
|
|
@@ -547,8 +563,9 @@ func CheckExist(executor Executor, executeParams *sql_tpl.CheckExistExecuteParam
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. executeParams: 检查操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+executeParams: 检查操作需要的参数,如下所示
|
|
|
|
|
|
```go
|
|
|
type CheckExistExecuteParams struct {
|
|
|
@@ -561,8 +578,9 @@ Conditions可以通过sql_tpl中的NewConditions()函数创建,其中有各种
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
-1. 是否存在的结果
|
|
|
-2. 是否出现错误
|
|
|
+是否存在的结果
|
|
|
+
|
|
|
+是否出现错误
|
|
|
|
|
|
```go
|
|
|
func CheckHasOnlyOne(executor Executor, executeParams *sql_tpl.CheckHasOnlyOneExecuteParams) (bool, error)
|
|
|
@@ -572,8 +590,9 @@ func CheckHasOnlyOne(executor Executor, executeParams *sql_tpl.CheckHasOnlyOneEx
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. executeParams: 检查操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+executeParams: 检查操作需要的参数,如下所示
|
|
|
|
|
|
```go
|
|
|
type CheckHasOnlyOneExecuteParams struct {
|
|
|
@@ -586,8 +605,9 @@ Conditions可以通过sql_tpl中的NewConditions()函数创建,其中有各种
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
-1. 是否唯一的结果
|
|
|
-2. 是否出现错误
|
|
|
+是否唯一的结果
|
|
|
+
|
|
|
+是否出现错误
|
|
|
|
|
|
```go
|
|
|
func ExecuteRawSql(executor Executor, sql string, executeParams map[string]any) ([]map[string]any, error)
|
|
|
@@ -597,14 +617,17 @@ func ExecuteRawSql(executor Executor, sql string, executeParams map[string]any)
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. sql: SQL语句,可以使用Golang模板语法编写
|
|
|
-2. executeParams: 检查操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+sql: SQL语句,可以使用Golang模板语法编写
|
|
|
+
|
|
|
+executeParams: 检查操作需要的参数,如下所示
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
-1. 执行结果,对于写操作,结果为空,对于读操作,为读出的数据
|
|
|
-2. 是否出现错误
|
|
|
+执行结果,对于写操作,结果为空,对于读操作,为读出的数据
|
|
|
+
|
|
|
+是否出现错误
|
|
|
|
|
|
```go
|
|
|
func ExecuteSql(executor Executor, name string, executeParams map[string]any) ([]map[string]any, error)
|
|
|
@@ -614,11 +637,14 @@ func ExecuteSql(executor Executor, name string, executeParams map[string]any) ([
|
|
|
|
|
|
参数:
|
|
|
|
|
|
-1. executor: 执行器
|
|
|
-2. name: 数据服务的SQL资源名称
|
|
|
-2. executeParams: 检查操作需要的参数,如下所示
|
|
|
+executor: 执行器
|
|
|
+
|
|
|
+name: 数据服务的SQL资源名称
|
|
|
+
|
|
|
+executeParams: 检查操作需要的参数,如下所示
|
|
|
|
|
|
返回值:
|
|
|
|
|
|
-1. 执行结果,对于写操作,结果为空,对于读操作,为读出的数据
|
|
|
-2. 是否出现错误
|
|
|
+执行结果,对于写操作,结果为空,对于读操作,为读出的数据
|
|
|
+
|
|
|
+是否出现错误
|