yjp 1 năm trước cách đây
mục cha
commit
ca22523e1e

+ 6 - 6
convenient/domain/configuration/api.go

@@ -3,9 +3,9 @@ package configuration
 import (
 	"git.sxidc.com/go-framework/baize/convenient/value_object_crud"
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure/database"
@@ -46,10 +46,10 @@ func (simple *Simple) bind(binder *binding.Binder) {
 
 	if !options.disableQuery {
 		binding.GetBind(binder, &binding.SimpleBindItem[map[string]any]{
-			Path:          "/configuration/values",
-			ResponseFunc:  response.SendMapResponse,
-			RequestParams: &GetConfigurationValuesQueryParams{},
-			Objects:       []domain.Object{&Entity{}},
+			Path:             "/configuration/values",
+			SendResponseFunc: response.SendMapResponse,
+			RequestParams:    &GetConfigurationValuesQueryParams{},
+			Objects:          []domain.Object{&Entity{}},
 			ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (map[string]any, error) {
 				dbExecutor := i.DBExecutor()
 

+ 8 - 8
convenient/domain/sql_executor/api.go

@@ -2,9 +2,9 @@ package sql_executor
 
 import (
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure/database"
@@ -22,9 +22,9 @@ func (simple *Simple) bind(binder *binding.Binder) {
 	sqlExecuteLogTableName := domain.TableName(simple.Schema, &SqlExecuteLog{})
 
 	binding.PostBind(binder, &binding.SimpleBindItem[map[string]any]{
-		Path:          "/sql/execute",
-		ResponseFunc:  response.SendMapResponse,
-		RequestParams: &ExecuteSqlJsonBody{},
+		Path:             "/sql/execute",
+		SendResponseFunc: response.SendMapResponse,
+		RequestParams:    &ExecuteSqlJsonBody{},
 		ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (map[string]any, error) {
 			errResponse := map[string]any{
 				"result": make([]sql.Result, 0),
@@ -76,9 +76,9 @@ func (simple *Simple) bind(binder *binding.Binder) {
 	})
 
 	binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[SqlExecuteLogInfo]]{
-		Path:          "/sql/execute/log",
-		ResponseFunc:  response.SendInfosResponse[SqlExecuteLogInfo],
-		RequestParams: &QuerySqlExecuteLogQueryParams{},
+		Path:             "/sql/execute/log",
+		SendResponseFunc: response.SendInfosResponse[SqlExecuteLogInfo],
+		RequestParams:    &QuerySqlExecuteLogQueryParams{},
 		ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (response.InfosData[SqlExecuteLogInfo], error) {
 			errResponse := response.InfosData[SqlExecuteLogInfo]{
 				Infos: make([]SqlExecuteLogInfo, 0),

+ 3 - 1
convenient/domain/sql_executor/request_params.go

@@ -1,6 +1,8 @@
 package sql_executor
 
-import "git.sxidc.com/go-framework/baize/framework/binding/request"
+import (
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+)
 
 type ExecuteSqlJsonBody struct {
 	Sql          string `json:"sql" binding:"required"`

+ 2 - 2
convenient/entity_crud/service.go

@@ -2,9 +2,9 @@ package entity_crud
 
 import (
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"

+ 1 - 1
convenient/entity_crud/service_callbacks.go

@@ -1,7 +1,7 @@
 package entity_crud
 
 import (
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure/database"

+ 42 - 42
convenient/entity_crud/simple.go

@@ -2,9 +2,9 @@ package entity_crud
 
 import (
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 )
@@ -55,19 +55,19 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
 	if !createOptions.disable {
 		if !createOptions.needTx {
 			binding.PostBind[string](binder, &binding.SimpleBindItem[string]{
-				Path:          domainPath + "/create",
-				ResponseFunc:  response.SendIDResponse,
-				RequestParams: simple.CreateJsonBody,
-				Objects:       []domain.Object{simple.Entity},
-				ServiceFunc:   Create(tableName, createOptions.callbacks),
+				Path:             domainPath + "/create",
+				SendResponseFunc: response.SendIDResponse,
+				RequestParams:    simple.CreateJsonBody,
+				Objects:          []domain.Object{simple.Entity},
+				ServiceFunc:      Create(tableName, createOptions.callbacks),
 			}, createOptions.middlewares...)
 		} else {
 			binding.PostBind(binder, &binding.SimpleBindItem[string]{
-				Path:          domainPath + "/create",
-				ResponseFunc:  response.SendIDResponse,
-				RequestParams: simple.CreateJsonBody,
-				Objects:       []domain.Object{simple.Entity},
-				ServiceFunc:   CreateTx(tableName, createOptions.callbacks),
+				Path:             domainPath + "/create",
+				SendResponseFunc: response.SendIDResponse,
+				RequestParams:    simple.CreateJsonBody,
+				Objects:          []domain.Object{simple.Entity},
+				ServiceFunc:      CreateTx(tableName, createOptions.callbacks),
 			}, createOptions.middlewares...)
 		}
 	}
@@ -76,19 +76,19 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
 	if !deleteOptions.disable {
 		if !deleteOptions.needTx {
 			binding.DeleteBind(binder, &binding.SimpleBindItem[any]{
-				Path:          domainPath + "/delete",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.DeleteQueryParams,
-				Objects:       []domain.Object{simple.Entity},
-				ServiceFunc:   Delete(tableName, deleteOptions.callbacks),
+				Path:             domainPath + "/delete",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.DeleteQueryParams,
+				Objects:          []domain.Object{simple.Entity},
+				ServiceFunc:      Delete(tableName, deleteOptions.callbacks),
 			}, deleteOptions.middlewares...)
 		} else {
 			binding.DeleteBind(binder, &binding.SimpleBindItem[any]{
-				Path:          domainPath + "/delete",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.DeleteQueryParams,
-				Objects:       []domain.Object{simple.Entity},
-				ServiceFunc:   DeleteTx(tableName, deleteOptions.callbacks),
+				Path:             domainPath + "/delete",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.DeleteQueryParams,
+				Objects:          []domain.Object{simple.Entity},
+				ServiceFunc:      DeleteTx(tableName, deleteOptions.callbacks),
 			}, deleteOptions.middlewares...)
 		}
 	}
@@ -97,19 +97,19 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
 	if !updateOptions.disable {
 		if !updateOptions.needTx {
 			binding.PutBind(binder, &binding.SimpleBindItem[any]{
-				Path:          domainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.UpdateJsonBody,
-				Objects:       []domain.Object{simple.Entity},
-				ServiceFunc:   Update(tableName, updateOptions.callbacks),
+				Path:             domainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.UpdateJsonBody,
+				Objects:          []domain.Object{simple.Entity},
+				ServiceFunc:      Update(tableName, updateOptions.callbacks),
 			}, updateOptions.middlewares...)
 		} else {
 			binding.PutBind(binder, &binding.SimpleBindItem[any]{
-				Path:          domainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.UpdateJsonBody,
-				Objects:       []domain.Object{simple.Entity},
-				ServiceFunc:   UpdateTx(tableName, updateOptions.callbacks),
+				Path:             domainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.UpdateJsonBody,
+				Objects:          []domain.Object{simple.Entity},
+				ServiceFunc:      UpdateTx(tableName, updateOptions.callbacks),
 			}, updateOptions.middlewares...)
 		}
 	}
@@ -117,22 +117,22 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
 	// 查询
 	if !queryOptions.disable {
 		binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[I]]{
-			Path:          domainPath + "/query",
-			ResponseFunc:  response.SendInfosResponse[I],
-			RequestParams: simple.QueryQueryParams,
-			Objects:       []domain.Object{simple.Entity},
-			ServiceFunc:   Query[I](tableName, queryOptions.callbacks, queryOptions.conditionFieldCallback),
+			Path:             domainPath + "/query",
+			SendResponseFunc: response.SendInfosResponse[I],
+			RequestParams:    simple.QueryQueryParams,
+			Objects:          []domain.Object{simple.Entity},
+			ServiceFunc:      Query[I](tableName, queryOptions.callbacks, queryOptions.conditionFieldCallback),
 		}, queryOptions.middlewares...)
 	}
 
 	// 通过ID获取
 	if !getByIDOptions.disable {
 		binding.GetBind(binder, &binding.SimpleBindItem[I]{
-			Path:          domainPath + "/get",
-			ResponseFunc:  response.SendInfoResponse[I],
-			RequestParams: simple.GetByIDQueryParams,
-			Objects:       []domain.Object{simple.Entity},
-			ServiceFunc:   GetByID[I](tableName, getByIDOptions.callbacks),
+			Path:             domainPath + "/get",
+			SendResponseFunc: response.SendInfoResponse[I],
+			RequestParams:    simple.GetByIDQueryParams,
+			Objects:          []domain.Object{simple.Entity},
+			ServiceFunc:      GetByID[I](tableName, getByIDOptions.callbacks),
 		}, getByIDOptions.middlewares...)
 	}
 }

+ 2 - 2
convenient/relation/many2many/service.go

@@ -2,9 +2,9 @@ package many2many
 
 import (
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"

+ 18 - 18
convenient/relation/many2many/simple.go

@@ -3,8 +3,8 @@ package many2many
 import (
 	"fmt"
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 )
@@ -57,10 +57,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableLeftUpdate {
 			// 左到右更新
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          leftDomainPath + rightDomainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.LeftUpdateJsonBody,
-				Objects:       []domain.Object{simple.Left},
+				Path:             leftDomainPath + rightDomainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.LeftUpdateJsonBody,
+				Objects:          []domain.Object{simple.Left},
 				ServiceFunc: Update(middleTableName,
 					leftTableName, simple.Left.DomainCNName(), leftRelationFieldName, leftRelationColumnName,
 					rightTableName, rightRelationColumnName),
@@ -70,10 +70,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableLeftQuery {
 			// 左到右查询
 			binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[RI]]{
-				Path:          leftDomainPath + rightDomainPath + "/query",
-				ResponseFunc:  response.SendInfosResponse[RI],
-				RequestParams: simple.LeftQueryQueryParams,
-				Objects:       []domain.Object{simple.Left},
+				Path:             leftDomainPath + rightDomainPath + "/query",
+				SendResponseFunc: response.SendInfosResponse[RI],
+				RequestParams:    simple.LeftQueryQueryParams,
+				Objects:          []domain.Object{simple.Left},
 				ServiceFunc: Query[RI](middleTableName,
 					leftTableName, leftRelationColumnName,
 					rightTableName, rightRelationColumnName),
@@ -85,10 +85,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableRightUpdate {
 			// 右到左更新
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          rightDomainPath + leftDomainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.RightUpdateJsonBody,
-				Objects:       []domain.Object{simple.Right},
+				Path:             rightDomainPath + leftDomainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.RightUpdateJsonBody,
+				Objects:          []domain.Object{simple.Right},
 				ServiceFunc: Update(middleTableName,
 					rightTableName, simple.Right.DomainCNName(), rightRelationFieldName, rightRelationColumnName,
 					leftTableName, leftRelationColumnName),
@@ -98,10 +98,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableRightQuery {
 			// 右到左查询
 			binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[LI]]{
-				Path:          rightDomainPath + leftDomainPath + "/query",
-				ResponseFunc:  response.SendInfosResponse[LI],
-				RequestParams: simple.RightQueryQueryParams,
-				Objects:       []domain.Object{simple.Right},
+				Path:             rightDomainPath + leftDomainPath + "/query",
+				SendResponseFunc: response.SendInfosResponse[LI],
+				RequestParams:    simple.RightQueryQueryParams,
+				Objects:          []domain.Object{simple.Right},
 				ServiceFunc: Query[LI](middleTableName,
 					rightTableName, rightRelationColumnName,
 					leftTableName, leftRelationColumnName),

+ 2 - 2
convenient/relation/one2many/service.go

@@ -2,9 +2,9 @@ package one2many
 
 import (
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"

+ 25 - 25
convenient/relation/one2many/simple.go

@@ -3,8 +3,8 @@ package one2many
 import (
 	"fmt"
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 )
@@ -58,10 +58,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableLeftUpdate {
 			// 左到右更新
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          leftDomainPath + rightDomainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.LeftUpdateJsonBody,
-				Objects:       []domain.Object{simple.Left},
+				Path:             leftDomainPath + rightDomainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.LeftUpdateJsonBody,
+				Objects:          []domain.Object{simple.Left},
 				ServiceFunc: UpdateLeft(leftTableName, simple.Left.DomainCNName(), leftRelationFieldName,
 					rightTableName, simple.Right.DomainCNName(), rightRelationColumnName),
 			})
@@ -70,11 +70,11 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableLeftQuery {
 			// 左到右查询
 			binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[RI]]{
-				Path:          leftDomainPath + rightDomainPath + "/query",
-				ResponseFunc:  response.SendInfosResponse[RI],
-				RequestParams: simple.LeftQueryQueryParams,
-				Objects:       []domain.Object{simple.Left},
-				ServiceFunc:   QueryLeft[RI](leftTableName, rightTableName, rightRelationColumnName),
+				Path:             leftDomainPath + rightDomainPath + "/query",
+				SendResponseFunc: response.SendInfosResponse[RI],
+				RequestParams:    simple.LeftQueryQueryParams,
+				Objects:          []domain.Object{simple.Left},
+				ServiceFunc:      QueryLeft[RI](leftTableName, rightTableName, rightRelationColumnName),
 			})
 		}
 	}
@@ -83,10 +83,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableRightUpdate {
 			// 右到左更新
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          rightDomainPath + leftDomainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.RightUpdateJsonBody,
-				Objects:       []domain.Object{simple.Right},
+				Path:             rightDomainPath + leftDomainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.RightUpdateJsonBody,
+				Objects:          []domain.Object{simple.Right},
 				ServiceFunc: UpdateRight(rightTableName, rightRelationFieldName, rightRelationColumnName,
 					leftTableName, simple.Left.DomainCNName()),
 			})
@@ -95,22 +95,22 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableRightQuery {
 			// 右到左查询
 			binding.GetBind(binder, &binding.SimpleBindItem[LI]{
-				Path:          rightDomainPath + leftDomainPath + "/query",
-				ResponseFunc:  response.SendInfoResponse[LI],
-				RequestParams: simple.RightQueryQueryParams,
-				Objects:       []domain.Object{simple.Right},
-				ServiceFunc:   QueryRight[LI](rightTableName, rightRelationFieldName, leftTableName),
+				Path:             rightDomainPath + leftDomainPath + "/query",
+				SendResponseFunc: response.SendInfoResponse[LI],
+				RequestParams:    simple.RightQueryQueryParams,
+				Objects:          []domain.Object{simple.Right},
+				ServiceFunc:      QueryRight[LI](rightTableName, rightRelationFieldName, leftTableName),
 			})
 		}
 
 		if !options.disableRightWithLeftQuery {
 			// 右到左查询,携带左方信息
 			binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[map[string]any]]{
-				Path:          rightDomainPath + leftDomainPath + "/queryWith",
-				ResponseFunc:  response.SendInfosResponse[map[string]any],
-				RequestParams: simple.RightQueryWithLeftQueryParams,
-				Objects:       []domain.Object{simple.Right},
-				ServiceFunc:   QueryRightWithLeftInfo[RI, LI](rightTableName, rightRelationColumnName, options.rightQueryWithConditionFieldCallback, leftTableName),
+				Path:             rightDomainPath + leftDomainPath + "/queryWith",
+				SendResponseFunc: response.SendInfosResponse[map[string]any],
+				RequestParams:    simple.RightQueryWithLeftQueryParams,
+				Objects:          []domain.Object{simple.Right},
+				ServiceFunc:      QueryRightWithLeftInfo[RI, LI](rightTableName, rightRelationColumnName, options.rightQueryWithConditionFieldCallback, leftTableName),
 			})
 		}
 	}

+ 2 - 2
convenient/relation/one2one/service.go

@@ -2,9 +2,9 @@ package one2one
 
 import (
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"

+ 30 - 30
convenient/relation/one2one/simple.go

@@ -3,8 +3,8 @@ package one2one
 import (
 	"fmt"
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 )
@@ -62,10 +62,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableLeftUpdate {
 			// 左到右更新
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          leftDomainPath + rightDomainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.LeftUpdateJsonBody,
-				Objects:       []domain.Object{simple.Left},
+				Path:             leftDomainPath + rightDomainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.LeftUpdateJsonBody,
+				Objects:          []domain.Object{simple.Left},
 				ServiceFunc: Update(leftTableName, leftRelationFieldName, leftRelationColumnName,
 					rightTableName, simple.Right.DomainCNName(), rightRelationColumnName),
 			})
@@ -74,22 +74,22 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableLeftQuery {
 			// 左到右查询
 			binding.GetBind(binder, &binding.SimpleBindItem[RI]{
-				Path:          leftDomainPath + rightDomainPath + "/query",
-				ResponseFunc:  response.SendInfoResponse[RI],
-				RequestParams: simple.LeftQueryQueryParams,
-				Objects:       []domain.Object{simple.Left},
-				ServiceFunc:   Query[RI](leftTableName, leftRelationFieldName, rightTableName),
+				Path:             leftDomainPath + rightDomainPath + "/query",
+				SendResponseFunc: response.SendInfoResponse[RI],
+				RequestParams:    simple.LeftQueryQueryParams,
+				Objects:          []domain.Object{simple.Left},
+				ServiceFunc:      Query[RI](leftTableName, leftRelationFieldName, rightTableName),
 			})
 		}
 
 		if !options.disableLeftWithRightQuery {
 			// 左到右查询,携带右方信息
 			binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[map[string]any]]{
-				Path:          leftDomainPath + rightDomainPath + "/queryWith",
-				ResponseFunc:  response.SendInfosResponse[map[string]any],
-				RequestParams: simple.LeftQueryWithRightQueryParams,
-				Objects:       []domain.Object{simple.Left},
-				ServiceFunc:   QueryWithOtherInfo[LI, RI](leftTableName, leftRelationColumnName, options.leftQueryWithConditionFieldCallback, rightTableName),
+				Path:             leftDomainPath + rightDomainPath + "/queryWith",
+				SendResponseFunc: response.SendInfosResponse[map[string]any],
+				RequestParams:    simple.LeftQueryWithRightQueryParams,
+				Objects:          []domain.Object{simple.Left},
+				ServiceFunc:      QueryWithOtherInfo[LI, RI](leftTableName, leftRelationColumnName, options.leftQueryWithConditionFieldCallback, rightTableName),
 			})
 		}
 	}
@@ -98,10 +98,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableRightUpdate {
 			// 右到左更新
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          rightDomainPath + leftDomainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.RightUpdateJsonBody,
-				Objects:       []domain.Object{simple.Right},
+				Path:             rightDomainPath + leftDomainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.RightUpdateJsonBody,
+				Objects:          []domain.Object{simple.Right},
 				ServiceFunc: Update(rightTableName, rightRelationFieldName, rightRelationColumnName,
 					leftTableName, simple.Left.DomainCNName(), leftRelationColumnName),
 			})
@@ -110,22 +110,22 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableRightQuery {
 			// 右到左查询
 			binding.GetBind(binder, &binding.SimpleBindItem[LI]{
-				Path:          rightDomainPath + leftDomainPath + "/query",
-				ResponseFunc:  response.SendInfoResponse[LI],
-				RequestParams: simple.RightQueryQueryParams,
-				Objects:       []domain.Object{simple.Right},
-				ServiceFunc:   Query[LI](rightTableName, rightRelationFieldName, leftTableName),
+				Path:             rightDomainPath + leftDomainPath + "/query",
+				SendResponseFunc: response.SendInfoResponse[LI],
+				RequestParams:    simple.RightQueryQueryParams,
+				Objects:          []domain.Object{simple.Right},
+				ServiceFunc:      Query[LI](rightTableName, rightRelationFieldName, leftTableName),
 			})
 		}
 
 		if !options.disableRightWithLeftQuery {
 			// 右到左查询,携带左方信息
 			binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[map[string]any]]{
-				Path:          rightDomainPath + leftDomainPath + "/queryWith",
-				ResponseFunc:  response.SendInfosResponse[map[string]any],
-				RequestParams: simple.RightQueryWithLeftQueryParams,
-				Objects:       []domain.Object{simple.Right},
-				ServiceFunc:   QueryWithOtherInfo[RI, LI](rightTableName, rightRelationColumnName, options.rightQueryWithConditionFieldCallback, leftTableName),
+				Path:             rightDomainPath + leftDomainPath + "/queryWith",
+				SendResponseFunc: response.SendInfosResponse[map[string]any],
+				RequestParams:    simple.RightQueryWithLeftQueryParams,
+				Objects:          []domain.Object{simple.Right},
+				ServiceFunc:      QueryWithOtherInfo[RI, LI](rightTableName, rightRelationColumnName, options.rightQueryWithConditionFieldCallback, leftTableName),
 			})
 		}
 	}

+ 2 - 2
convenient/relation/remote/service.go

@@ -2,9 +2,9 @@ package remote
 
 import (
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"

+ 28 - 28
convenient/relation/remote/simple.go

@@ -3,8 +3,8 @@ package remote
 import (
 	"fmt"
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
 	"reflect"
@@ -67,10 +67,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableLeftUpdate {
 			// 左到右更新
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          leftDomainPath + rightDomainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.LeftUpdateJsonBody,
-				Objects:       []domain.Object{simple.Left},
+				Path:             leftDomainPath + rightDomainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.LeftUpdateJsonBody,
+				Objects:          []domain.Object{simple.Left},
 				ServiceFunc: Update(middleTableName,
 					leftRemote, leftTableName, simple.Left.DomainCNName(), leftRelationFieldName, leftRelationColumnName,
 					rightRemote, rightTableName, rightRelationColumnName),
@@ -81,18 +81,18 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 			// 左到右查询
 			if rightRemote {
 				binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[string]]{
-					Path:          leftDomainPath + rightDomainPath + "/query",
-					ResponseFunc:  response.SendInfosResponse[string],
-					RequestParams: simple.LeftQueryQueryParams,
-					Objects:       []domain.Object{simple.Left},
-					ServiceFunc:   QueryToRemote(middleTableName, leftRemote, leftTableName, leftRelationColumnName, rightRelationColumnName),
+					Path:             leftDomainPath + rightDomainPath + "/query",
+					SendResponseFunc: response.SendInfosResponse[string],
+					RequestParams:    simple.LeftQueryQueryParams,
+					Objects:          []domain.Object{simple.Left},
+					ServiceFunc:      QueryToRemote(middleTableName, leftRemote, leftTableName, leftRelationColumnName, rightRelationColumnName),
 				})
 			} else {
 				binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[RI]]{
-					Path:          leftDomainPath + rightDomainPath + "/query",
-					ResponseFunc:  response.SendInfosResponse[RI],
-					RequestParams: simple.LeftQueryQueryParams,
-					Objects:       []domain.Object{simple.Left},
+					Path:             leftDomainPath + rightDomainPath + "/query",
+					SendResponseFunc: response.SendInfosResponse[RI],
+					RequestParams:    simple.LeftQueryQueryParams,
+					Objects:          []domain.Object{simple.Left},
 					ServiceFunc: QueryToExist[RI](middleTableName,
 						leftRemote, leftTableName, leftRelationColumnName,
 						rightTableName, rightRelationColumnName),
@@ -105,10 +105,10 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 		if !options.disableRightUpdate {
 			// 右到左更新
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          rightDomainPath + leftDomainPath + "/update",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.RightUpdateJsonBody,
-				Objects:       []domain.Object{simple.Right},
+				Path:             rightDomainPath + leftDomainPath + "/update",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.RightUpdateJsonBody,
+				Objects:          []domain.Object{simple.Right},
 				ServiceFunc: Update(middleTableName,
 					rightRemote, rightTableName, simple.Right.DomainCNName(), rightRelationFieldName, rightRelationColumnName,
 					leftRemote, leftTableName, leftRelationColumnName),
@@ -119,18 +119,18 @@ func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
 			// 右到左查询
 			if leftRemote {
 				binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[string]]{
-					Path:          rightDomainPath + leftDomainPath + "/query",
-					ResponseFunc:  response.SendInfosResponse[string],
-					RequestParams: simple.RightQueryQueryParams,
-					Objects:       []domain.Object{simple.Right},
-					ServiceFunc:   QueryToRemote(middleTableName, rightRemote, rightTableName, rightRelationColumnName, leftRelationColumnName),
+					Path:             rightDomainPath + leftDomainPath + "/query",
+					SendResponseFunc: response.SendInfosResponse[string],
+					RequestParams:    simple.RightQueryQueryParams,
+					Objects:          []domain.Object{simple.Right},
+					ServiceFunc:      QueryToRemote(middleTableName, rightRemote, rightTableName, rightRelationColumnName, leftRelationColumnName),
 				})
 			} else {
 				binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[LI]]{
-					Path:          rightDomainPath + leftDomainPath + "/query",
-					ResponseFunc:  response.SendInfosResponse[LI],
-					RequestParams: simple.RightQueryQueryParams,
-					Objects:       []domain.Object{simple.Right},
+					Path:             rightDomainPath + leftDomainPath + "/query",
+					SendResponseFunc: response.SendInfosResponse[LI],
+					RequestParams:    simple.RightQueryQueryParams,
+					Objects:          []domain.Object{simple.Right},
 					ServiceFunc: QueryToExist[LI](middleTableName,
 						rightRemote, rightTableName, rightRelationColumnName,
 						leftTableName, leftRelationColumnName),

+ 2 - 2
convenient/value_object_crud/service.go

@@ -2,9 +2,9 @@ package value_object_crud
 
 import (
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/value_object"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"

+ 1 - 1
convenient/value_object_crud/service_callbacks.go

@@ -1,7 +1,7 @@
 package value_object_crud
 
 import (
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/value_object"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure/database"

+ 21 - 21
convenient/value_object_crud/simple.go

@@ -2,9 +2,9 @@ package value_object_crud
 
 import (
 	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/domain/value_object"
 )
@@ -45,19 +45,19 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
 	if !createOptions.disable {
 		if !createOptions.needTx {
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          domainPath + "/create",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.CreateJsonBody,
-				Objects:       []domain.Object{simple.ValueObject},
-				ServiceFunc:   Create(tableName, createOptions.callbacks),
+				Path:             domainPath + "/create",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.CreateJsonBody,
+				Objects:          []domain.Object{simple.ValueObject},
+				ServiceFunc:      Create(tableName, createOptions.callbacks),
 			})
 		} else {
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
-				Path:          domainPath + "/create",
-				ResponseFunc:  response.SendMsgResponse,
-				RequestParams: simple.CreateJsonBody,
-				Objects:       []domain.Object{simple.ValueObject},
-				ServiceFunc:   CreateTx(tableName, createOptions.callbacks),
+				Path:             domainPath + "/create",
+				SendResponseFunc: response.SendMsgResponse,
+				RequestParams:    simple.CreateJsonBody,
+				Objects:          []domain.Object{simple.ValueObject},
+				ServiceFunc:      CreateTx(tableName, createOptions.callbacks),
 			})
 		}
 	}
@@ -67,18 +67,18 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
 		if !deleteOptions.needTx {
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
 				Path:                  domainPath + "/delete",
-				ResponseFunc:          response.SendMsgResponse,
+				SendResponseFunc:      response.SendMsgResponse,
 				RequestParams:         simple.DeleteJsonBody,
-				RequestParamsBindFunc: request.JsonBody,
+				BindRequestParamsFunc: request.BindJsonBody,
 				Objects:               []domain.Object{simple.ValueObject},
 				ServiceFunc:           Delete(tableName, deleteOptions.callbacks),
 			})
 		} else {
 			binding.PostBind(binder, &binding.SimpleBindItem[any]{
 				Path:                  domainPath + "/delete",
-				ResponseFunc:          response.SendMsgResponse,
+				SendResponseFunc:      response.SendMsgResponse,
 				RequestParams:         simple.DeleteJsonBody,
-				RequestParamsBindFunc: request.JsonBody,
+				BindRequestParamsFunc: request.BindJsonBody,
 				Objects:               []domain.Object{simple.ValueObject},
 				ServiceFunc:           DeleteTx(tableName, deleteOptions.callbacks),
 			})
@@ -88,11 +88,11 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
 	// 查询
 	if !queryOptions.disable {
 		binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[I]]{
-			Path:          domainPath + "/query",
-			ResponseFunc:  response.SendInfosResponse[I],
-			RequestParams: simple.QueryQueryParams,
-			Objects:       []domain.Object{simple.ValueObject},
-			ServiceFunc:   Query(tableName, queryOptions.callbacks, queryOptions.conditionFieldCallback),
+			Path:             domainPath + "/query",
+			SendResponseFunc: response.SendInfosResponse[I],
+			RequestParams:    simple.QueryQueryParams,
+			Objects:          []domain.Object{simple.ValueObject},
+			ServiceFunc:      Query(tableName, queryOptions.callbacks, queryOptions.conditionFieldCallback),
 		})
 	}
 }

+ 14 - 14
framework/binding/bind_item.go

@@ -1,8 +1,8 @@
 package binding
 
 import (
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-tools/utils/reflectutils"
 	"git.sxidc.com/go-tools/utils/strutils"
@@ -31,7 +31,7 @@ func (item *BindItem[O]) bind(binder *Binder, middlewares ...api.Handler) {
 		panic("需要指定方法")
 	}
 
-	if item.ResponseFunc == nil {
+	if item.SendResponseFunc == nil {
 		panic("需要指定响应函数")
 	}
 
@@ -61,7 +61,7 @@ func (item *BindItem[O]) bind(binder *Binder, middlewares ...api.Handler) {
 			if item.RequestParams != nil {
 				requestParamsType := reflect.TypeOf(item.RequestParams)
 				if !reflectutils.IsTypeStructOrStructPointer(requestParamsType) {
-					item.ResponseFunc(c, http.StatusOK, outputZero, fserr.New("请求参数不是结构或结构指针"))
+					item.SendResponseFunc(c, http.StatusOK, outputZero, fserr.New("请求参数不是结构或结构指针"))
 					return
 				}
 
@@ -72,10 +72,10 @@ func (item *BindItem[O]) bind(binder *Binder, middlewares ...api.Handler) {
 				}
 
 				// 将请求数据解析到请求参数中
-				if item.RequestParamsBindFunc != nil {
-					err := item.RequestParamsBindFunc(c, params)
+				if item.BindRequestParamsFunc != nil {
+					err := item.BindRequestParamsFunc(c, params)
 					if err != nil {
-						item.ResponseFunc(c, http.StatusBadRequest, outputZero, err)
+						item.SendResponseFunc(c, http.StatusBadRequest, outputZero, err)
 						return
 					}
 				} else {
@@ -83,17 +83,17 @@ func (item *BindItem[O]) bind(binder *Binder, middlewares ...api.Handler) {
 					case http.MethodPost:
 						fallthrough
 					case http.MethodPut:
-						err := request.JsonBody(c, params)
+						err := request.BindJsonBody(c, params)
 						if err != nil {
-							item.ResponseFunc(c, http.StatusBadRequest, outputZero, err)
+							item.SendResponseFunc(c, http.StatusBadRequest, outputZero, err)
 							return
 						}
 					case http.MethodDelete:
 						fallthrough
 					case http.MethodGet:
-						err := request.QueryParams(c, params)
+						err := request.BindQueryParams(c, params)
 						if err != nil {
-							item.ResponseFunc(c, http.StatusBadRequest, outputZero, err)
+							item.SendResponseFunc(c, http.StatusBadRequest, outputZero, err)
 							return
 						}
 					}
@@ -105,7 +105,7 @@ func (item *BindItem[O]) bind(binder *Binder, middlewares ...api.Handler) {
 			if item.FormDomainObjectsFunc != nil {
 				innerDomainObjects, err := item.FormDomainObjectsFunc(c, params)
 				if err != nil {
-					item.ResponseFunc(c, http.StatusOK, outputZero, err)
+					item.SendResponseFunc(c, http.StatusOK, outputZero, err)
 					return
 				}
 
@@ -119,7 +119,7 @@ func (item *BindItem[O]) bind(binder *Binder, middlewares ...api.Handler) {
 
 						objectType := reflect.TypeOf(object)
 						if !reflectutils.IsTypeStructOrStructPointer(objectType) {
-							item.ResponseFunc(c, http.StatusOK, outputZero, fserr.New("领域对象不是结构或结构指针"))
+							item.SendResponseFunc(c, http.StatusOK, outputZero, fserr.New("领域对象不是结构或结构指针"))
 							return
 						}
 
@@ -128,7 +128,7 @@ func (item *BindItem[O]) bind(binder *Binder, middlewares ...api.Handler) {
 						if params != nil {
 							err := request.AssignRequestParamsToDomainObject(params, obj)
 							if err != nil {
-								item.ResponseFunc(c, http.StatusOK, outputZero, err)
+								item.SendResponseFunc(c, http.StatusOK, outputZero, err)
 								return
 							}
 						}
@@ -146,7 +146,7 @@ func (item *BindItem[O]) bind(binder *Binder, middlewares ...api.Handler) {
 				statusCode = fserr.ParseCode(err).HttpCode
 			}
 
-			item.ResponseFunc(c, statusCode, outputModel, err)
+			item.SendResponseFunc(c, statusCode, outputModel, err)
 			return
 		},
 	}

+ 7 - 8
framework/binding/simple_bind_item.go

@@ -1,8 +1,9 @@
 package binding
 
 import (
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
 	"git.sxidc.com/go-framework/baize/framework/core/api"
+	"git.sxidc.com/go-framework/baize/framework/core/api/request"
+	"git.sxidc.com/go-framework/baize/framework/core/api/response"
 	"git.sxidc.com/go-framework/baize/framework/core/domain"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"
 	"net/http"
@@ -24,10 +25,8 @@ func GetBind[O any](binder *Binder, item *SimpleBindItem[O], middlewares ...api.
 	item.bind(binder, http.MethodGet, middlewares...)
 }
 
-type RequestParamsBindFunc func(c *api.Context, params request.Params) error
 type FormDomainObjectsFunc func(c *api.Context, params request.Params) ([]domain.Object, error)
 type ServiceFunc[O any] func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (O, error)
-type ResponseFunc[O any] func(c *api.Context, statusCode int, data O, err error)
 
 // SimpleBindItem 简化的BindItem
 type SimpleBindItem[O any] struct {
@@ -35,7 +34,7 @@ type SimpleBindItem[O any] struct {
 	Path string
 
 	// 响应泛型函数,如果不响应,需要使用NoResponse零值占位
-	ResponseFunc ResponseFunc[O]
+	SendResponseFunc response.SendResponseFunc[O]
 
 	// 使用的请求参数,非必传,当请求参数为nil时,说明该接口没有参数
 	RequestParams request.Params
@@ -43,11 +42,11 @@ type SimpleBindItem[O any] struct {
 	// 可选的请求参数绑定函数
 	// 非必传,POST和PUT请求默认为JsonBody,DELETE和GET默认为QueryParams
 	// 额外还提供了一些转化函数:
-	// PathParams: 绑定路径参数
-	// MultipartForm: 绑定multipart form
-	// FormBody: 绑定form body
+	// BindPathParams: 绑定路径参数
+	// BindMultipartForm: 绑定multipart form
+	// BindFormBody: 绑定form body
 	// XMLBody: 绑定XML body
-	RequestParamsBindFunc RequestParamsBindFunc
+	BindRequestParamsFunc request.BindRequestParamsFunc
 
 	// 通过请求参数构造使用的领域对象,之后在ServiceFunc中会按照构造实体的顺序进行回调
 	// 非必传,如果为nil,则说明没有领域对象

+ 0 - 0
framework/binding/request/common.go → framework/core/api/request/common.go


+ 0 - 0
framework/binding/request/params.go → framework/core/api/request/params.go


+ 8 - 6
framework/binding/request/params_bind_func.go → framework/core/api/request/params_bind_func.go

@@ -6,7 +6,9 @@ import (
 	"github.com/gin-gonic/gin/binding"
 )
 
-func JsonBody(c *api.Context, params Params) error {
+type BindRequestParamsFunc func(c *api.Context, params Params) error
+
+func BindJsonBody(c *api.Context, params Params) error {
 	err := c.ShouldBindJSON(params)
 	if err != nil {
 		return fserr.New(err.Error())
@@ -15,7 +17,7 @@ func JsonBody(c *api.Context, params Params) error {
 	return nil
 }
 
-func QueryParams(c *api.Context, params Params) error {
+func BindQueryParams(c *api.Context, params Params) error {
 	err := c.ShouldBindQuery(params)
 	if err != nil {
 		return fserr.New(err.Error())
@@ -24,7 +26,7 @@ func QueryParams(c *api.Context, params Params) error {
 	return nil
 }
 
-func PathParams(c *api.Context, params Params) error {
+func BindPathParams(c *api.Context, params Params) error {
 	err := c.ShouldBindUri(params)
 	if err != nil {
 		return fserr.New(err.Error())
@@ -33,7 +35,7 @@ func PathParams(c *api.Context, params Params) error {
 	return nil
 }
 
-func MultipartForm(c *api.Context, params Params) error {
+func BindMultipartForm(c *api.Context, params Params) error {
 	err := c.ShouldBindWith(params, binding.FormMultipart)
 	if err != nil {
 		return fserr.New(err.Error())
@@ -42,7 +44,7 @@ func MultipartForm(c *api.Context, params Params) error {
 	return nil
 }
 
-func FormBody(c *api.Context, params Params) error {
+func BindFormBody(c *api.Context, params Params) error {
 	err := c.ShouldBindWith(params, binding.Form)
 	if err != nil {
 		return fserr.New(err.Error())
@@ -51,7 +53,7 @@ func FormBody(c *api.Context, params Params) error {
 	return nil
 }
 
-func XMLBody(c *api.Context, params Params) error {
+func BindXMLBody(c *api.Context, params Params) error {
 	err := c.ShouldBindXML(params)
 	if err != nil {
 		return fserr.New(err.Error())

+ 2 - 0
framework/binding/response/response.go → framework/core/api/response/response.go

@@ -8,6 +8,8 @@ import (
 	"git.sxidc.com/service-supports/websocket"
 )
 
+type SendResponseFunc[O any] func(c *api.Context, statusCode int, data O, err error)
+
 func NoResponse(_ *api.Context, _ int, _ any, _ error) {
 	return
 }

+ 0 - 0
framework/binding/response/response_data.go → framework/core/api/response/response_data.go


+ 1 - 1
framework/core/infrastructure/database/data_service/grpc_client/grpc_client.go

@@ -13,7 +13,7 @@ type Client struct {
 }
 
 func NewClient(address string) (*Client, error) {
-	conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
+	conn, err := grpc.NewClient(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
 	if err != nil {
 		return nil, err
 	}