yjp 1 ano atrás
pai
commit
3901c8c5dc

+ 0 - 0
convenient/entity/service.go → convenient/entity/service.go


+ 0 - 0
convenient/entity/service_callbacks.go → convenient/entity/service_callbacks.go


+ 0 - 0
convenient/entity/simple.go → convenient/entity/simple.go


+ 0 - 0
convenient/value_object/service.go → convenient/value_object/service.go


+ 0 - 0
convenient/value_object/service_callbacks.go → convenient/value_object/service_callbacks.go


+ 0 - 0
convenient/value_object/simple.go → convenient/value_object/simple.go


+ 4 - 7
examples/binding/main.go

@@ -2,10 +2,10 @@ package main
 
 import (
 	"git.sxidc.com/go-framework/baize"
-	"git.sxidc.com/go-framework/baize/ convenient/entity"
 	"git.sxidc.com/go-framework/baize/application"
 	"git.sxidc.com/go-framework/baize/binding"
 	"git.sxidc.com/go-framework/baize/binding/request"
+	"git.sxidc.com/go-framework/baize/convenient/entity"
 	"git.sxidc.com/go-framework/baize/domain"
 	"git.sxidc.com/go-framework/baize/infrastructure"
 	"git.sxidc.com/go-framework/baize/infrastructure/database/operations"
@@ -15,10 +15,10 @@ import (
 )
 
 // curl -X POST -H "Content-Type: application/json" -d '{"name":"test", "studentNum": 10}' "http://localhost:10100/test/v1/class/create"
-// curl -X PUT -H "Content-Type: application/json" -d '{"id":"f4fac01661704c5985bfc009f0fe6c3e", "name":"test-new"}' "http://localhost:10100/test/v1/class/update"
+// curl -X PUT -H "Content-Type: application/json" -d '{"id":"1a8d5cf5c4574430903e7cfcf2f13e4f", "name":"test-new"}' "http://localhost:10100/test/v1/class/update"
 // curl -X GET "http://localhost:10100/test/v1/class/query?name=test-new&pageNo=1&pageSize=1"
-// curl -X GET "http://localhost:10100/test/v1/class/get?id=f4fac01661704c5985bfc009f0fe6c3e"
-// curl -X DELETE "http://localhost:10100/test/v1/class/f4fac01661704c5985bfc009f0fe6c3e/delete"
+// curl -X GET "http://localhost:10100/test/v1/class/get?id=1a8d5cf5c4574430903e7cfcf2f13e4f"
+// curl -X DELETE "http://localhost:10100/test/v1/class/1a8d5cf5c4574430903e7cfcf2f13e4f/delete"
 
 type CreateClassJsonBody struct {
 	Name       string `json:"name" binding:"required" assign:"toField:Name"`
@@ -152,11 +152,8 @@ func main() {
 		DBExecutorType:     binding.DBExecutorOperations,
 		DomainPath:         "/class",
 		CreateJsonBody:     &CreateClassJsonBody{},
-		CreateNeedTx:       true,
 		DeleteQueryParams:  &DeleteClassPathParams{},
-		DeleteNeedTx:       false,
 		UpdateJsonBody:     &UpdateClassJsonBody{},
-		UpdateNeedTx:       false,
 		QueryParams:        &QueryClassesQueryParams{},
 		GetByIDQueryParams: &GetClassQueryParams{},
 	}, entity.WithCreateTx[ClassInfo]())

+ 5 - 8
examples/binding_ds/main.go

@@ -2,10 +2,10 @@ package main
 
 import (
 	"git.sxidc.com/go-framework/baize"
-	"git.sxidc.com/go-framework/baize/ convenient/entity"
 	"git.sxidc.com/go-framework/baize/application"
 	"git.sxidc.com/go-framework/baize/binding"
 	"git.sxidc.com/go-framework/baize/binding/request"
+	"git.sxidc.com/go-framework/baize/convenient/entity"
 	"git.sxidc.com/go-framework/baize/domain"
 	"git.sxidc.com/go-framework/baize/infrastructure"
 	"git.sxidc.com/go-framework/baize/infrastructure/database/data_service"
@@ -15,10 +15,10 @@ import (
 )
 
 // curl -X POST -H "Content-Type: application/json" -d '{"name":"test", "studentNum": 10}' "http://localhost:10100/test/v1/class/create"
-// curl -X PUT -H "Content-Type: application/json" -d '{"id":"9270f37031874ff985d34bff3ff5b23b", "name":"test-new"}' "http://localhost:10100/test/v1/class/update"
+// curl -X PUT -H "Content-Type: application/json" -d '{"id":"92cede40e5464ff79541418a7fc738ec", "name":"test-new"}' "http://localhost:10100/test/v1/class/update"
 // curl -X GET "http://localhost:10100/test/v1/class/query?name=test-new&pageNo=1&pageSize=1"
-// curl -X GET "http://localhost:10100/test/v1/class/get?id=9270f37031874ff985d34bff3ff5b23b"
-// curl -X DELETE "http://localhost:10100/test/v1/class/9270f37031874ff985d34bff3ff5b23b/delete"
+// curl -X GET "http://localhost:10100/test/v1/class/get?id=92cede40e5464ff79541418a7fc738ec"
+// curl -X DELETE "http://localhost:10100/test/v1/class/92cede40e5464ff79541418a7fc738ec/delete"
 
 type CreateClassJsonBody struct {
 	Name       string `json:"name" binding:"required" assign:"toField:Name"`
@@ -107,14 +107,11 @@ func main() {
 		DBExecutorType:     binding.DBExecutorDataService,
 		DomainPath:         "/class",
 		CreateJsonBody:     &CreateClassJsonBody{},
-		CreateNeedTx:       false,
 		DeleteQueryParams:  &DeleteClassPathParams{},
-		DeleteNeedTx:       false,
 		UpdateJsonBody:     &UpdateClassJsonBody{},
-		UpdateNeedTx:       true,
 		QueryParams:        &QueryClassesQueryParams{},
 		GetByIDQueryParams: &GetClassQueryParams{},
-	})
+	}, entity.WithUpdateTx[ClassInfo](), entity.WithDeleteTx[ClassInfo]())
 
 	go func() {
 		err := app.Start()