Browse Source

删除demo

yjp 1 year ago
parent
commit
92ab3640d7
53 changed files with 83 additions and 2159 deletions
  1. 49 0
      convenient/gateway/gateway.go
  2. 31 0
      convenient/gateway/pass_through.go
  3. 0 51
      examples/examples/assign_tag/main.go
  4. 0 70
      examples/examples/project/application/application.go
  5. 0 92
      examples/examples/project/application/domain/class/entity.go
  6. 0 12
      examples/examples/project/application/domain/class/info.go
  7. 0 41
      examples/examples/project/application/domain/class/request_params.go
  8. 0 109
      examples/examples/project/application/domain/family/entity.go
  9. 0 12
      examples/examples/project/application/domain/family/info.go
  10. 0 47
      examples/examples/project/application/domain/family/request_params.go
  11. 0 58
      examples/examples/project/application/domain/hobby/entity.go
  12. 0 16
      examples/examples/project/application/domain/hobby/request_params.go
  13. 0 90
      examples/examples/project/application/domain/identity/entity.go
  14. 0 11
      examples/examples/project/application/domain/identity/info.go
  15. 0 38
      examples/examples/project/application/domain/identity/request_params.go
  16. 0 93
      examples/examples/project/application/domain/student/entity.go
  17. 0 11
      examples/examples/project/application/domain/student/info.go
  18. 0 75
      examples/examples/project/application/domain/student/request_params.go
  19. 0 36
      examples/examples/project/application/service/class.go
  20. 0 38
      examples/examples/project/application/service/class_and_student.go
  21. 0 28
      examples/examples/project/application/service/configuration.go
  22. 0 36
      examples/examples/project/application/service/family.go
  23. 0 36
      examples/examples/project/application/service/identity.go
  24. 0 25
      examples/examples/project/application/service/service.go
  25. 0 36
      examples/examples/project/application/service/student.go
  26. 0 39
      examples/examples/project/application/service/student_and_family.go
  27. 0 37
      examples/examples/project/application/service/student_and_hobby.go
  28. 0 37
      examples/examples/project/application/service/student_and_identity.go
  29. 0 38
      examples/examples/project/application/service/version.go
  30. 0 71
      examples/examples/project/config/config.go
  31. 0 21
      examples/examples/project/deployment/config/config.yaml
  32. 0 9
      examples/examples/project/deployment/data_service/apply_data_containers.ps1
  33. 0 10
      examples/examples/project/deployment/data_service/apply_data_containers.sh
  34. 0 20
      examples/examples/project/deployment/data_service/base.yaml
  35. 0 30
      examples/examples/project/deployment/data_service/data_containers/class.yaml
  36. 0 23
      examples/examples/project/deployment/data_service/data_containers/configuration.yaml
  37. 0 35
      examples/examples/project/deployment/data_service/data_containers/family.yaml
  38. 0 25
      examples/examples/project/deployment/data_service/data_containers/identity.yaml
  39. 0 35
      examples/examples/project/deployment/data_service/data_containers/student.yaml
  40. 0 16
      examples/examples/project/deployment/data_service/data_containers/student_and_hobby.yaml
  41. 0 16
      examples/examples/project/deployment/data_service/data_containers/student_and_identity.yaml
  42. 0 9
      examples/examples/project/deployment/data_service/delete_data_containers.ps1
  43. 0 10
      examples/examples/project/deployment/data_service/delete_data_containers.sh
  44. 0 100
      examples/examples/project/main.go
  45. 0 83
      examples/examples/project/test/configuration_test.go
  46. 0 186
      examples/examples/project/test/tool_kit.go
  47. 0 20
      examples/examples/project/test/version_test.go
  48. 0 102
      examples/examples/quick_start/main.go
  49. 0 51
      examples/examples/sql_mapping_tag/main.go
  50. 0 51
      examples/examples/sql_result_tag/main.go
  51. 2 2
      framework/core/infrastructure/database/operations/operations.go
  52. 1 8
      go.mod
  53. 0 14
      go.sum

+ 49 - 0
convenient/gateway/gateway.go

@@ -0,0 +1,49 @@
+package gateway
+
+import "git.sxidc.com/go-tools/utils/http_client"
+
+type Gateway struct {
+	httpClient *http_client.Client
+
+	options *Options
+}
+
+func NewGateway(opts ...Option) *Gateway {
+	options := new(Options)
+
+	for _, opt := range opts {
+		opt(options)
+	}
+
+	if options.timeoutSec == 0 {
+		options.timeoutSec = 30
+	}
+
+	return &Gateway{
+		httpClient: http_client.New(),
+		options:    options,
+	}
+}
+
+func DestroyGateway(gateway *Gateway) {
+	if gateway == nil {
+		return
+	}
+
+	http_client.Destroy(gateway.httpClient)
+	gateway.httpClient = nil
+
+	gateway = nil
+}
+
+type Option func(options *Options)
+
+type Options struct {
+	timeoutSec int64
+}
+
+func WithTimeoutSec(timeoutSec int64) Option {
+	return func(options *Options) {
+		options.timeoutSec = timeoutSec
+	}
+}

+ 31 - 0
convenient/gateway/pass_through.go

@@ -0,0 +1,31 @@
+package gateway
+
+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/domain"
+	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"
+	"net/http"
+)
+
+type PassThrough struct {
+	HttpMethod   string
+	RelativePath string
+	ToUrl        string
+}
+
+func (gw *Gateway) BindPassThrough(binder *binding.Binder, passThrough *PassThrough, middlewares ...api.Handler) {
+	binding.Bind[any](binder, &binding.BindItem[any]{
+		Method: passThrough.HttpMethod,
+		SimpleBindItem: &binding.SimpleBindItem[any]{
+			Path:         passThrough.RelativePath,
+			ResponseFunc: response.NoResponse,
+			ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
+				c.Redirect(http.StatusTemporaryRedirect, passThrough.ToUrl)
+				return nil, nil
+			},
+		},
+	}, middlewares...)
+}

+ 0 - 51
examples/examples/assign_tag/main.go

@@ -1,51 +0,0 @@
-package main
-
-import (
-	"fmt"
-	assign2 "git.sxidc.com/go-framework/baize/framework/core/tag/assign"
-	"reflect"
-	"time"
-)
-
-type JsonBodyID struct {
-	ID string `assign:"toField:Id"`
-}
-
-type UpdateClassJsonBody struct {
-	JsonBodyID
-	Name        string `assign:"toField:Name"`
-	CreatedTime *time.Time
-	UpdatedTime *time.Time
-}
-
-type DomainID struct {
-	Id string
-}
-
-type ClassDomain struct {
-	*DomainID
-	Name        string
-	CreatedTime *time.Time
-}
-
-func main() {
-	class := new(ClassDomain)
-
-	err := assign2.UseTag(&UpdateClassJsonBody{}, class,
-		func(fromFieldName string, fromFieldElemValue reflect.Value, retFieldElementValue reflect.Value, assignTag *assign2.Tag) error {
-			fmt.Println("Field Name:", fromFieldName)
-			fmt.Println("Type:", fromFieldElemValue.Type().String())
-			if fromFieldElemValue.Kind() == reflect.String {
-				fmt.Printf("\"%+v\"\n", fromFieldElemValue.Interface())
-			} else {
-				fmt.Printf("%+v\n", fromFieldElemValue.Interface())
-			}
-			fmt.Printf("%+v\n", assignTag)
-			fmt.Println()
-
-			return nil
-		})
-	if err != nil {
-		panic(err)
-	}
-}

+ 0 - 70
examples/examples/project/application/application.go

@@ -1,70 +0,0 @@
-package application
-
-import (
-	"git.sxidc.com/go-framework/baize"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/service"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/config"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-	"net/http"
-)
-
-var appInstance *application.App
-
-func NewApp() {
-	if appInstance != nil {
-		return
-	}
-
-	appInstance = baize.NewApplication(config.GetConfig().ApplicationConfig)
-
-	// 注册Router
-	appInstance.Api().PrefixRouter().RegisterVersionedRouter("v1")
-}
-
-func DestroyApp() {
-	if appInstance == nil {
-		return
-	}
-
-	baize.DestroyApplication(appInstance)
-	appInstance = nil
-}
-
-func Start() error {
-	// 初始化服务
-	for _, svc := range service.RegisteredServices {
-		err := svc.Init(appInstance)
-		if err != nil {
-			return err
-		}
-	}
-
-	err := appInstance.Start()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func Finish() error {
-	err := appInstance.Finish()
-	if err != nil {
-		return err
-	}
-
-	// 销毁服务
-	for _, svc := range service.RegisteredServices {
-		err := svc.Destroy()
-		if err != nil {
-			return err
-		}
-	}
-
-	return nil
-}
-
-func ServerHttpForTest(w http.ResponseWriter, req *http.Request) {
-	appInstance.Api().RootRouter().(*api.RootRouter).ServerHttp(w, req)
-}

+ 0 - 92
examples/examples/project/application/domain/class/entity.go

@@ -1,92 +0,0 @@
-package class
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
-	"git.sxidc.com/go-tools/utils/strutils"
-	"git.sxidc.com/service-supports/fserr"
-)
-
-const (
-	ColumnName       = "name"
-	ColumnStudentNum = "student_num"
-)
-
-const (
-	fieldNameMaxLen = 128
-)
-
-type Entity struct {
-	entity.Base
-	Name       string   `sqlmapping:"column:name" sqlresult:"column:name"`
-	StudentNum int      `sqlmapping:"column:student_num;updateClear;" sqlresult:"column:student_num"`
-	StudentIDs []string `sqlmapping:"-" sqlresult:"-"`
-	entity.TimeFields
-}
-
-func (e *Entity) DomainCNName() string {
-	return "班级"
-}
-
-func (e *Entity) DomainCamelName() string {
-	return "Class"
-}
-
-func (e *Entity) CheckFieldID() error {
-	return e.Base.CheckFieldID(e.DomainCNName())
-}
-
-func (e *Entity) ForCreate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	err = e.checkFieldName()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (e *Entity) ForDelete() error {
-	return e.CheckFieldID()
-}
-
-func (e *Entity) ForUpdate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	err = e.checkUpdateFields()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (e *Entity) checkFieldName() error {
-	if strutils.IsStringEmpty(e.Name) {
-		return fserr.New(e.DomainCNName() + "名称为空")
-	}
-
-	if len(e.Name) > fieldNameMaxLen {
-		return fserr.New(e.DomainCNName() + "名称超出限定长度")
-	}
-
-	return nil
-}
-
-func (e *Entity) checkUpdateFields() error {
-	if strutils.AllBlank(e.Name) {
-		return fserr.New(e.DomainCNName() + "没有传递需要更新的字段")
-	}
-
-	if strutils.IsStringNotEmpty(e.Name) && len(e.Name) > fieldNameMaxLen {
-		return fserr.New(e.DomainCNName() + "名称超出限定长度")
-	}
-
-	return nil
-}

+ 0 - 12
examples/examples/project/application/domain/class/info.go

@@ -1,12 +0,0 @@
-package class
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-type Info struct {
-	application.InfoIDField
-	Name       string `json:"name" sqlresult:"column:name"`
-	StudentNum int    `json:"studentNum" sqlresult:"column:student_num"`
-	application.InfoTimeFields
-}

+ 0 - 41
examples/examples/project/application/domain/class/request_params.go

@@ -1,41 +0,0 @@
-package class
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-)
-
-type (
-	CreateJsonBody struct {
-		Name       string `json:"name" binding:"required" assign:"toField:Name"`
-		StudentNum int    `json:"studentNum" binding:"required" assign:"toField:StudentNum"`
-	}
-
-	DeleteQueryParams struct {
-		request.IDQueryParam
-	}
-
-	UpdateJsonBody struct {
-		request.IDJsonBody
-		Name       string `json:"name" assign:"toField:Name"`
-		StudentNum int    `json:"studentNum" assign:"toField:StudentNum"`
-	}
-
-	QueryQueryParams struct {
-		request.BaseQueryParams
-		Name       string `form:"name" assign:"toField:Name"`
-		StudentNum int    `form:"studentNum" assign:"toField:StudentNum"`
-	}
-
-	GetByIDQueryParams struct {
-		request.IDQueryParam
-	}
-
-	UpdateStudentsOfClassJsonBody struct {
-		request.IDJsonBody
-		StudentIDs []string `json:"studentIds" assign:"toField:StudentIDs"`
-	}
-
-	QueryStudentsOfClassQueryParams struct {
-		request.BaseQueryWithIDParams
-	}
-)

+ 0 - 109
examples/examples/project/application/domain/family/entity.go

@@ -1,109 +0,0 @@
-package family
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
-	"git.sxidc.com/go-tools/utils/strutils"
-	"git.sxidc.com/service-supports/fserr"
-)
-
-const (
-	ColumnFather = "father"
-	ColumnMother = "mother"
-)
-
-const (
-	fieldFatherMaxLen = 128
-	fieldMotherMaxLen = 128
-)
-
-type Entity struct {
-	entity.Base
-	Father    string `sqlmapping:"column:father" sqlresult:"column:father"`
-	Mother    string `sqlmapping:"column:mother" sqlresult:"column:mother"`
-	StudentID string `sqlmapping:"column:student_id" sqlresult:"column:student_id"`
-	entity.TimeFields
-}
-
-func (e *Entity) DomainCNName() string {
-	return "家庭"
-}
-
-func (e *Entity) DomainCamelName() string {
-	return "Family"
-}
-
-func (e *Entity) CheckFieldID() error {
-	return e.Base.CheckFieldID(e.DomainCNName())
-}
-
-func (e *Entity) ForCreate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	err = e.checkFieldFather()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (e *Entity) ForDelete() error {
-	return e.CheckFieldID()
-}
-
-func (e *Entity) ForUpdate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	err = e.checkUpdateFields()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (e *Entity) checkFieldFather() error {
-	if strutils.IsStringEmpty(e.Father) {
-		return fserr.New(e.DomainCNName() + "父亲姓名为空")
-	}
-
-	if len(e.Father) > fieldFatherMaxLen {
-		return fserr.New(e.DomainCNName() + "父亲姓名超出限定长度")
-	}
-
-	return nil
-}
-
-func (e *Entity) checkFieldMother() error {
-	if strutils.IsStringEmpty(e.Mother) {
-		return fserr.New(e.DomainCNName() + "母亲姓名为空")
-	}
-
-	if len(e.Mother) > fieldMotherMaxLen {
-		return fserr.New(e.DomainCNName() + "母亲姓名超出限定长度")
-	}
-
-	return nil
-}
-
-func (e *Entity) checkUpdateFields() error {
-	if strutils.AllBlank(e.Father, e.Mother) {
-		return fserr.New(e.DomainCNName() + "没有传递需要更新的字段")
-	}
-
-	if strutils.IsStringNotEmpty(e.Father) && len(e.Father) > fieldFatherMaxLen {
-		return fserr.New(e.DomainCNName() + "父亲姓名超出限定长度")
-	}
-
-	if strutils.IsStringNotEmpty(e.Mother) && len(e.Mother) > fieldMotherMaxLen {
-		return fserr.New(e.DomainCNName() + "母亲姓名超出限定长度")
-	}
-
-	return nil
-}

+ 0 - 12
examples/examples/project/application/domain/family/info.go

@@ -1,12 +0,0 @@
-package family
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-type Info struct {
-	application.InfoIDField
-	Father string `json:"father" sqlresult:"column:father"`
-	Mother string `json:"mother" sqlresult:"column:mother"`
-	application.InfoTimeFields
-}

+ 0 - 47
examples/examples/project/application/domain/family/request_params.go

@@ -1,47 +0,0 @@
-package family
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-)
-
-type (
-	CreateJsonBody struct {
-		Father string `json:"father" binding:"required" assign:"toField:Father"`
-		Mother string `json:"mother" binding:"required" assign:"toField:Mother"`
-	}
-
-	DeleteQueryParams struct {
-		request.IDQueryParam
-	}
-
-	UpdateJsonBody struct {
-		request.IDJsonBody
-		Father string `json:"father" assign:"toField:Father"`
-		Mother string `json:"mother" assign:"toField:Mother"`
-	}
-
-	QueryQueryParams struct {
-		request.BaseQueryParams
-		Father string `form:"father" assign:"toField:Father"`
-		Mother string `form:"mother" assign:"toField:Mother"`
-	}
-
-	GetByIDQueryParams struct {
-		request.IDQueryParam
-	}
-
-	UpdateStudentOfFamilyJsonBody struct {
-		request.IDJsonBody
-		StudentID string `json:"studentId" assign:"toField:StudentID"`
-	}
-
-	QueryStudentOfFamilyQueryParams struct {
-		request.IDQueryParam
-	}
-
-	QueryFamilyWithStudentQueryParams struct {
-		request.BaseQueryParams
-		Father string `form:"father" assign:"toField:Father"`
-		Mother string `form:"mother" assign:"toField:Mother"`
-	}
-)

+ 0 - 58
examples/examples/project/application/domain/hobby/entity.go

@@ -1,58 +0,0 @@
-package hobby
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
-	"git.sxidc.com/go-tools/utils/strutils"
-)
-
-type Entity struct {
-	ID         string   `sqlmapping:"-" sqlresult:"-"`
-	StudentIDs []string `sqlmapping:"-" sqlresult:"-"`
-}
-
-func (e *Entity) DBSchema() string {
-	return ""
-}
-
-func (e *Entity) GenerateID() error {
-	e.ID = strutils.SimpleUUID()
-	return nil
-}
-
-func (e *Entity) GetID() string {
-	return e.ID
-}
-
-func (e *Entity) CheckFieldID() error {
-	return entity.CheckID(e.DomainCNName(), "ID", e.ID)
-}
-
-func (e *Entity) DomainCNName() string {
-	return "爱好"
-}
-
-func (e *Entity) DomainCamelName() string {
-	return "Hobby"
-}
-
-func (e *Entity) ForCreate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (e *Entity) ForDelete() error {
-	return e.CheckFieldID()
-}
-
-func (e *Entity) ForUpdate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}

+ 0 - 16
examples/examples/project/application/domain/hobby/request_params.go

@@ -1,16 +0,0 @@
-package hobby
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-)
-
-type (
-	UpdateStudentsOfHobbyJsonBody struct {
-		request.IDJsonBody
-		StudentIDs []string `json:"studentIds" assign:"toField:StudentIDs"`
-	}
-
-	QueryStudentsOfHobbyQueryParams struct {
-		request.BaseQueryWithIDParams
-	}
-)

+ 0 - 90
examples/examples/project/application/domain/identity/entity.go

@@ -1,90 +0,0 @@
-package identity
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
-	"git.sxidc.com/go-tools/utils/strutils"
-	"git.sxidc.com/service-supports/fserr"
-)
-
-const (
-	ColumnName = "name"
-)
-
-const (
-	fieldNameMaxLen = 128
-)
-
-type Entity struct {
-	entity.Base
-	Name       string   `sqlmapping:"column:name" sqlresult:"column:name"`
-	StudentIDs []string `sqlmapping:"-" sqlresult:"-"`
-	entity.TimeFields
-}
-
-func (e *Entity) DomainCNName() string {
-	return "身份"
-}
-
-func (e *Entity) DomainCamelName() string {
-	return "Identity"
-}
-
-func (e *Entity) CheckFieldID() error {
-	return e.Base.CheckFieldID(e.DomainCNName())
-}
-
-func (e *Entity) ForCreate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	err = e.checkFieldName()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (e *Entity) ForDelete() error {
-	return e.CheckFieldID()
-}
-
-func (e *Entity) ForUpdate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	err = e.checkUpdateFields()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (e *Entity) checkFieldName() error {
-	if strutils.IsStringEmpty(e.Name) {
-		return fserr.New(e.DomainCNName() + "名称为空")
-	}
-
-	if len(e.Name) > fieldNameMaxLen {
-		return fserr.New(e.DomainCNName() + "名称超出限定长度")
-	}
-
-	return nil
-}
-
-func (e *Entity) checkUpdateFields() error {
-	if strutils.AllBlank(e.Name) {
-		return fserr.New(e.DomainCNName() + "没有传递需要更新的字段")
-	}
-
-	if strutils.IsStringNotEmpty(e.Name) && len(e.Name) > fieldNameMaxLen {
-		return fserr.New(e.DomainCNName() + "名称超出限定长度")
-	}
-
-	return nil
-}

+ 0 - 11
examples/examples/project/application/domain/identity/info.go

@@ -1,11 +0,0 @@
-package identity
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-type Info struct {
-	application.InfoIDField
-	Name string `json:"name" sqlresult:"column:name"`
-	application.InfoTimeFields
-}

+ 0 - 38
examples/examples/project/application/domain/identity/request_params.go

@@ -1,38 +0,0 @@
-package identity
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-)
-
-type (
-	CreateJsonBody struct {
-		Name string `json:"name" binding:"required" assign:"toField:Name"`
-	}
-
-	DeleteQueryParams struct {
-		request.IDQueryParam
-	}
-
-	UpdateJsonBody struct {
-		request.IDJsonBody
-		Name string `json:"name" assign:"toField:Name"`
-	}
-
-	QueryQueryParams struct {
-		request.BaseQueryParams
-		Name string `form:"name" assign:"toField:Name"`
-	}
-
-	GetByIDQueryParams struct {
-		request.IDQueryParam
-	}
-
-	UpdateStudentsOfIdentityJsonBody struct {
-		request.IDJsonBody
-		StudentIDs []string `json:"studentIds" assign:"toField:StudentIDs"`
-	}
-
-	QueryStudentsOfIdentityQueryParams struct {
-		request.BaseQueryWithIDParams
-	}
-)

+ 0 - 93
examples/examples/project/application/domain/student/entity.go

@@ -1,93 +0,0 @@
-package student
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/core/domain/entity"
-	"git.sxidc.com/go-tools/utils/strutils"
-	"git.sxidc.com/service-supports/fserr"
-)
-
-const (
-	ColumnName = "name"
-)
-
-const (
-	fieldNameMaxLen = 128
-)
-
-type Entity struct {
-	entity.Base
-	Name        string   `sqlmapping:"column:name" sqlresult:"column:name"`
-	FamilyID    string   `sqlmapping:"column:family_id" sqlresult:"column:family_id"`
-	ClassID     string   `sqlmapping:"column:class_id" sqlresult:"column:class_id"`
-	IdentityIDs []string `sqlmapping:"-" sqlresult:"-"`
-	HobbyIDs    []string `sqlmapping:"-" sqlresult:"-"`
-	entity.TimeFields
-}
-
-func (e *Entity) DomainCNName() string {
-	return "学生"
-}
-
-func (e *Entity) DomainCamelName() string {
-	return "Student"
-}
-
-func (e *Entity) CheckFieldID() error {
-	return e.Base.CheckFieldID(e.DomainCNName())
-}
-
-func (e *Entity) ForCreate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	err = e.checkFieldName()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (e *Entity) ForDelete() error {
-	return e.CheckFieldID()
-}
-
-func (e *Entity) ForUpdate() error {
-	err := e.CheckFieldID()
-	if err != nil {
-		return err
-	}
-
-	err = e.checkUpdateFields()
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (e *Entity) checkFieldName() error {
-	if strutils.IsStringEmpty(e.Name) {
-		return fserr.New(e.DomainCNName() + "姓名为空")
-	}
-
-	if len(e.Name) > fieldNameMaxLen {
-		return fserr.New(e.DomainCNName() + "姓名超出限定长度")
-	}
-
-	return nil
-}
-
-func (e *Entity) checkUpdateFields() error {
-	if strutils.AllBlank(e.Name) {
-		return fserr.New(e.DomainCNName() + "没有传递需要更新的字段")
-	}
-
-	if strutils.IsStringNotEmpty(e.Name) && len(e.Name) > fieldNameMaxLen {
-		return fserr.New(e.DomainCNName() + "姓名超出限定长度")
-	}
-
-	return nil
-}

+ 0 - 11
examples/examples/project/application/domain/student/info.go

@@ -1,11 +0,0 @@
-package student
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-type Info struct {
-	application.InfoIDField
-	Name string `json:"name" sqlresult:"column:name"`
-	application.InfoTimeFields
-}

+ 0 - 75
examples/examples/project/application/domain/student/request_params.go

@@ -1,75 +0,0 @@
-package student
-
-import (
-	"git.sxidc.com/go-framework/baize/framework/binding/request"
-)
-
-type (
-	CreateJsonBody struct {
-		Name string `json:"name" binding:"required" assign:"toField:Name"`
-	}
-
-	DeleteQueryParams struct {
-		request.IDQueryParam
-	}
-
-	UpdateJsonBody struct {
-		request.IDJsonBody
-		Name string `json:"name" assign:"toField:Name"`
-	}
-
-	QueryQueryParams struct {
-		request.BaseQueryParams
-		Name string `form:"name" assign:"toField:Name"`
-	}
-
-	GetByIDQueryParams struct {
-		request.IDQueryParam
-	}
-
-	UpdateFamilyOfStudentJsonBody struct {
-		request.IDJsonBody
-		FamilyID string `json:"familyId" assign:"toField:FamilyID"`
-	}
-
-	QueryFamilyOfStudentQueryParams struct {
-		request.IDQueryParam
-	}
-
-	QueryStudentWithFamilyQueryParams struct {
-		request.BaseQueryParams
-		Name string `form:"name" assign:"toField:Name"`
-	}
-
-	UpdateIdentitiesOfStudentJsonBody struct {
-		request.IDJsonBody
-		IdentityIDs []string `json:"identityIds" assign:"toField:IdentityIDs"`
-	}
-
-	QueryIdentitiesOfStudentQueryParams struct {
-		request.BaseQueryWithIDParams
-	}
-
-	UpdateHobbiesOfStudentJsonBody struct {
-		request.IDJsonBody
-		HobbyIDs []string `json:"hobbyIds" assign:"toField:HobbyIDs"`
-	}
-
-	QueryHobbiesOfStudentQueryParams struct {
-		request.BaseQueryWithIDParams
-	}
-
-	UpdateClassOfStudentJsonBody struct {
-		request.IDJsonBody
-		ClassID string `json:"classId" assign:"toField:ClassID"`
-	}
-
-	QueryClassOfStudentQueryParams struct {
-		request.BaseQueryWithIDParams
-	}
-
-	QueryStudentWithClassQueryParams struct {
-		request.BaseQueryParams
-		Name string `form:"name" assign:"toField:Name"`
-	}
-)

+ 0 - 36
examples/examples/project/application/service/class.go

@@ -1,36 +0,0 @@
-package service
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/entity_crud"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/class"
-	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-var classService = &ClassService{}
-
-type ClassService struct{}
-
-func (svc *ClassService) Init(appInstance *application.App) error {
-	svc.v1(appInstance)
-	return nil
-}
-
-func (svc *ClassService) Destroy() error {
-	return nil
-}
-
-func (svc *ClassService) v1(appInstance *application.App) {
-	v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
-
-	entity_crud.BindSimple[class.Info](v1Binder, &entity_crud.Simple[class.Info]{
-		Entity:             &class.Entity{},
-		Schema:             dbSchema,
-		CreateJsonBody:     &class.CreateJsonBody{},
-		DeleteQueryParams:  &class.DeleteQueryParams{},
-		UpdateJsonBody:     &class.UpdateJsonBody{},
-		QueryQueryParams:   &class.QueryQueryParams{},
-		GetByIDQueryParams: &class.GetByIDQueryParams{},
-	})
-}

+ 0 - 38
examples/examples/project/application/service/class_and_student.go

@@ -1,38 +0,0 @@
-package service
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/relation/one2many"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/class"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/student"
-	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-var classAndStudentService = &ClassAndStudentService{}
-
-type ClassAndStudentService struct{}
-
-func (svc *ClassAndStudentService) Init(appInstance *application.App) error {
-	svc.v1(appInstance)
-	return nil
-}
-
-func (svc *ClassAndStudentService) Destroy() error {
-	return nil
-}
-
-func (svc *ClassAndStudentService) v1(appInstance *application.App) {
-	v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
-
-	one2many.BindSimple(v1Binder, &one2many.Simple[class.Info, student.Info]{
-		Left:                          &class.Entity{},
-		Right:                         &student.Entity{},
-		Schema:                        dbSchema,
-		LeftUpdateJsonBody:            &class.UpdateStudentsOfClassJsonBody{},
-		LeftQueryQueryParams:          &class.QueryStudentsOfClassQueryParams{},
-		RightUpdateJsonBody:           &student.UpdateClassOfStudentJsonBody{},
-		RightQueryQueryParams:         &student.QueryClassOfStudentQueryParams{},
-		RightQueryWithLeftQueryParams: &student.QueryStudentWithClassQueryParams{},
-	})
-}

+ 0 - 28
examples/examples/project/application/service/configuration.go

@@ -1,28 +0,0 @@
-package service
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/domain/configuration"
-	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-var configurationService = &ConfigurationService{}
-
-type ConfigurationService struct{}
-
-func (svc *ConfigurationService) Init(appInstance *application.App) error {
-	svc.prefixRoot(appInstance)
-	return nil
-}
-
-func (svc *ConfigurationService) Destroy() error {
-	return nil
-}
-
-func (svc *ConfigurationService) prefixRoot(appInstance *application.App) {
-	prefixRootBinder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, ""), appInstance.Infrastructure())
-	configuration.BindConfiguration(prefixRootBinder, &configuration.Simple{
-		Schema: dbSchema,
-	})
-}

+ 0 - 36
examples/examples/project/application/service/family.go

@@ -1,36 +0,0 @@
-package service
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/entity_crud"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/family"
-	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-var familyService = &FamilyService{}
-
-type FamilyService struct{}
-
-func (svc *FamilyService) Init(appInstance *application.App) error {
-	svc.v1(appInstance)
-	return nil
-}
-
-func (svc *FamilyService) Destroy() error {
-	return nil
-}
-
-func (svc *FamilyService) v1(appInstance *application.App) {
-	v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
-
-	entity_crud.BindSimple[family.Info](v1Binder, &entity_crud.Simple[family.Info]{
-		Entity:             &family.Entity{},
-		Schema:             dbSchema,
-		CreateJsonBody:     &family.CreateJsonBody{},
-		DeleteQueryParams:  &family.DeleteQueryParams{},
-		UpdateJsonBody:     &family.UpdateJsonBody{},
-		QueryQueryParams:   &family.QueryQueryParams{},
-		GetByIDQueryParams: &family.GetByIDQueryParams{},
-	})
-}

+ 0 - 36
examples/examples/project/application/service/identity.go

@@ -1,36 +0,0 @@
-package service
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/entity_crud"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/identity"
-	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-var identityService = &IdentityService{}
-
-type IdentityService struct{}
-
-func (svc *IdentityService) Init(appInstance *application.App) error {
-	svc.v1(appInstance)
-	return nil
-}
-
-func (svc *IdentityService) Destroy() error {
-	return nil
-}
-
-func (svc *IdentityService) v1(appInstance *application.App) {
-	v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
-
-	entity_crud.BindSimple[identity.Info](v1Binder, &entity_crud.Simple[identity.Info]{
-		Entity:             &identity.Entity{},
-		Schema:             dbSchema,
-		CreateJsonBody:     &identity.CreateJsonBody{},
-		DeleteQueryParams:  &identity.DeleteQueryParams{},
-		UpdateJsonBody:     &identity.UpdateJsonBody{},
-		QueryQueryParams:   &identity.QueryQueryParams{},
-		GetByIDQueryParams: &identity.GetByIDQueryParams{},
-	})
-}

+ 0 - 25
examples/examples/project/application/service/service.go

@@ -1,25 +0,0 @@
-package service
-
-import "git.sxidc.com/go-framework/baize/framework/core/application"
-
-const (
-	dbSchema = "test"
-)
-
-type Service interface {
-	Init(appInstance *application.App) error
-	Destroy() error
-}
-
-var RegisteredServices = []Service{
-	versionService,
-	configurationService,
-	classService,
-	studentService,
-	identityService,
-	familyService,
-	classAndStudentService,
-	studentAndFamilyService,
-	studentAndIdentityService,
-	studentAndHobbyService,
-}

+ 0 - 36
examples/examples/project/application/service/student.go

@@ -1,36 +0,0 @@
-package service
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/entity_crud"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/student"
-	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-var studentService = &StudentService{}
-
-type StudentService struct{}
-
-func (svc *StudentService) Init(appInstance *application.App) error {
-	svc.v1(appInstance)
-	return nil
-}
-
-func (svc *StudentService) Destroy() error {
-	return nil
-}
-
-func (svc *StudentService) v1(appInstance *application.App) {
-	v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
-
-	entity_crud.BindSimple[student.Info](v1Binder, &entity_crud.Simple[student.Info]{
-		Entity:             &student.Entity{},
-		Schema:             dbSchema,
-		CreateJsonBody:     &student.CreateJsonBody{},
-		DeleteQueryParams:  &student.DeleteQueryParams{},
-		UpdateJsonBody:     &student.UpdateJsonBody{},
-		QueryQueryParams:   &student.QueryQueryParams{},
-		GetByIDQueryParams: &student.GetByIDQueryParams{},
-	})
-}

+ 0 - 39
examples/examples/project/application/service/student_and_family.go

@@ -1,39 +0,0 @@
-package service
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/relation/one2one"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/family"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/student"
-	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-var studentAndFamilyService = &StudentAndFamilyService{}
-
-type StudentAndFamilyService struct{}
-
-func (svc *StudentAndFamilyService) Init(appInstance *application.App) error {
-	svc.v1(appInstance)
-	return nil
-}
-
-func (svc *StudentAndFamilyService) Destroy() error {
-	return nil
-}
-
-func (svc *StudentAndFamilyService) v1(appInstance *application.App) {
-	v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
-
-	one2one.BindSimple(v1Binder, &one2one.Simple[student.Info, family.Info]{
-		Left:                          &student.Entity{},
-		Right:                         &family.Entity{},
-		Schema:                        dbSchema,
-		LeftUpdateJsonBody:            &student.UpdateFamilyOfStudentJsonBody{},
-		LeftQueryQueryParams:          &student.QueryFamilyOfStudentQueryParams{},
-		LeftQueryWithRightQueryParams: &student.QueryStudentWithFamilyQueryParams{},
-		RightUpdateJsonBody:           &family.UpdateStudentOfFamilyJsonBody{},
-		RightQueryQueryParams:         &family.QueryStudentOfFamilyQueryParams{},
-		RightQueryWithLeftQueryParams: &family.QueryFamilyWithStudentQueryParams{},
-	})
-}

+ 0 - 37
examples/examples/project/application/service/student_and_hobby.go

@@ -1,37 +0,0 @@
-package service
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/relation/remote"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/hobby"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/student"
-	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-var studentAndHobbyService = &StudentAndHobbyService{}
-
-type StudentAndHobbyService struct{}
-
-func (svc *StudentAndHobbyService) Init(appInstance *application.App) error {
-	svc.v1(appInstance)
-	return nil
-}
-
-func (svc *StudentAndHobbyService) Destroy() error {
-	return nil
-}
-
-func (svc *StudentAndHobbyService) v1(appInstance *application.App) {
-	v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
-
-	remote.BindSimple(v1Binder, &remote.Simple[student.Info, string]{
-		Left:                  &student.Entity{},
-		Right:                 &hobby.Entity{},
-		Schema:                dbSchema,
-		LeftUpdateJsonBody:    &student.UpdateHobbiesOfStudentJsonBody{},
-		LeftQueryQueryParams:  &student.QueryHobbiesOfStudentQueryParams{},
-		RightUpdateJsonBody:   &hobby.UpdateStudentsOfHobbyJsonBody{},
-		RightQueryQueryParams: &hobby.QueryStudentsOfHobbyQueryParams{},
-	})
-}

+ 0 - 37
examples/examples/project/application/service/student_and_identity.go

@@ -1,37 +0,0 @@
-package service
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/relation/many2many"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/identity"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application/domain/student"
-	"git.sxidc.com/go-framework/baize/framework/binding"
-	"git.sxidc.com/go-framework/baize/framework/core/api"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-)
-
-var studentAndIdentityService = &StudentAndIdentityService{}
-
-type StudentAndIdentityService struct{}
-
-func (svc *StudentAndIdentityService) Init(appInstance *application.App) error {
-	svc.v1(appInstance)
-	return nil
-}
-
-func (svc *StudentAndIdentityService) Destroy() error {
-	return nil
-}
-
-func (svc *StudentAndIdentityService) v1(appInstance *application.App) {
-	v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
-
-	many2many.BindSimple(v1Binder, &many2many.Simple[student.Info, identity.Info]{
-		Left:                  &student.Entity{},
-		Right:                 &identity.Entity{},
-		Schema:                dbSchema,
-		LeftUpdateJsonBody:    &student.UpdateIdentitiesOfStudentJsonBody{},
-		LeftQueryQueryParams:  &student.QueryIdentitiesOfStudentQueryParams{},
-		RightUpdateJsonBody:   &identity.UpdateStudentsOfIdentityJsonBody{},
-		RightQueryQueryParams: &identity.QueryStudentsOfIdentityQueryParams{},
-	})
-}

+ 0 - 38
examples/examples/project/application/service/version.go

@@ -1,38 +0,0 @@
-package service
-
-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/application"
-	"git.sxidc.com/go-framework/baize/framework/core/domain"
-	"git.sxidc.com/go-framework/baize/framework/core/infrastructure"
-)
-
-var versionService = &VersionService{}
-
-type VersionService struct{}
-
-func (svc *VersionService) Init(appInstance *application.App) error {
-	svc.prefixRoot(appInstance)
-	return nil
-}
-
-func (svc *VersionService) Destroy() error {
-	return nil
-}
-
-func (svc *VersionService) prefixRoot(appInstance *application.App) {
-	prefixRootBinder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, ""), appInstance.Infrastructure())
-
-	binding.GetBind(prefixRootBinder, &binding.SimpleBindItem[map[string]any]{
-		Path:         "/version",
-		ResponseFunc: response.SendMapResponse,
-		ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (map[string]any, error) {
-			return map[string]any{
-				"version": "v1.0.0",
-			}, nil
-		},
-	})
-}

+ 0 - 71
examples/examples/project/config/config.go

@@ -1,71 +0,0 @@
-package config
-
-import (
-	"fmt"
-	"git.sxidc.com/go-framework/baize/framework/core/application"
-	"git.sxidc.com/go-tools/utils/strutils"
-	"git.sxidc.com/service-supports/fslog"
-	"git.sxidc.com/service-supports/scm-sdk"
-	"os"
-)
-
-type Config struct {
-	ApplicationConfig application.Config
-}
-
-var conf Config
-
-func init() {
-	useSCMEnv := os.Getenv("USE_SCM")
-	if useSCMEnv == "true" {
-		initConfigFromSCM()
-	} else {
-		initConfigFromConfigFile()
-	}
-}
-
-func GetConfig() Config {
-	return conf
-}
-
-func initConfigFromSCM() {
-	scmBaseUrl := loadEnvOrPanic("SCM_BASE_URL")
-	scmNamespace := loadEnvOrPanic("SCM_NAMESPACE")
-	scmName := loadEnvOrPanic("SCM_NAME")
-
-	info, err := scm_sdk.GetCurrentConfiguration(scmBaseUrl, scmNamespace, scmName)
-	if err != nil {
-		fslog.Error(err)
-		panic(err)
-	}
-
-	applicationConfig, err := application.LoadFromYaml(info.Content)
-	if err != nil {
-		panic(err)
-	}
-
-	conf.ApplicationConfig = applicationConfig
-
-	fslog.Info("Load config from scm finish")
-}
-
-func initConfigFromConfigFile() {
-	configFilePath := os.Getenv("CONFIG_FILE_PATH")
-	applicationConfig, err := application.LoadFromYamlFile(configFilePath)
-	if err != nil {
-		panic(err)
-	}
-
-	conf.ApplicationConfig = applicationConfig
-
-	fmt.Println("Load config file finish")
-}
-
-func loadEnvOrPanic(envName string) string {
-	envValue := os.Getenv(envName)
-	if strutils.IsStringEmpty(envValue) {
-		panic("请配置" + envName)
-	}
-
-	return envValue
-}

+ 0 - 21
examples/examples/project/deployment/config/config.yaml

@@ -1,21 +0,0 @@
-api:
-  url_prefix: /example/api
-  port: 31000
-infrastructure:
-  database:
-    operations:
-      user_name: test
-      password: "123456"
-      address: localhost
-      port: 30432
-      database: test
-      max_connections: 20
-      max_idle_connections: 5
-#    data_service:
-#      token: "8qe+uPgpQ2JWxu3lSyOx5NjX+INp5WsnoD1ZWb7PBm4="
-#      address: "localhost"
-#      http_port: "10000"
-#      grpc_port: "10001"
-#      namespace: "baize"
-#      data_source: "baize"
-#      timeout_sec: 30

+ 0 - 9
examples/examples/project/deployment/data_service/apply_data_containers.ps1

@@ -1,9 +0,0 @@
-Set-Location  $(Split-Path $MyInvocation.MyCommand.Path -Parent)
-
-datactl.exe apply -f base.yaml
-
-foreach ($file in $(Get-ChildItem -Path ".\data_containers")) {
-    if ($file.GetType() -eq [System.IO.FileInfo]) {
-        datactl.exe apply -f $file.FullName
-    }
-}

+ 0 - 10
examples/examples/project/deployment/data_service/apply_data_containers.sh

@@ -1,10 +0,0 @@
-#!/bin/bash
-cd "$(dirname "$0")" || exit 1
-
-datactl apply -f base.yaml
-
-for file in ./data_containers/*; do
-	if [ -f "$file" ]; then
-		datactl apply -f "$file"
-	fi
-done

+ 0 - 20
examples/examples/project/deployment/data_service/base.yaml

@@ -1,20 +0,0 @@
-kind: Namespace
-spec:
-  name: baize
-
----
-
-kind: DataSource
-spec:
-  type: database
-  namespace: baize
-  name: baize
-  spec:
-    type: postgres
-    user_name: test
-    password: "123456"
-    address: "10.0.0.84"
-    port: "30432"
-    database: test
-    max_connections: 40
-    max_idle_connections: 10

+ 0 - 30
examples/examples/project/deployment/data_service/data_containers/class.yaml

@@ -1,30 +0,0 @@
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.classes
-  spec:
-    table_name: test.classes
-    columns:
-      - name: id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: name
-        type: varchar(128)
-        comment: 班名
-        not_null: true
-        index: true
-      - name: student_num
-        type: integer
-        comment: 学生数量
-        not_null: true
-        index: true
-      - name: created_time
-        type: "timestamp with time zone"
-        comment: 创建时间
-        not_null: true
-      - name: last_updated_time
-        type: "timestamp with time zone"
-        comment: 最近更新时间
-        not_null: true

+ 0 - 23
examples/examples/project/deployment/data_service/data_containers/configuration.yaml

@@ -1,23 +0,0 @@
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.configurations
-  spec:
-    table_name: test.configurations
-    columns:
-      - name: scope
-        type: varchar(256)
-        comment: 范围
-        not_null: true
-        primary_key: true
-      - name: group
-        type: varchar(256)
-        comment: 组
-        not_null: true
-        primary_key: true
-      - name: value
-        type: varchar(256)
-        comment: 值
-        not_null: true
-        index: true

+ 0 - 35
examples/examples/project/deployment/data_service/data_containers/family.yaml

@@ -1,35 +0,0 @@
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.families
-  spec:
-    table_name: test.families
-    columns:
-      - name: id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: father
-        type: varchar(128)
-        comment: 父亲姓名
-        not_null: true
-        index: true
-      - name: mother
-        type: varchar(128)
-        comment: 母亲姓名
-        not_null: true
-        index: true
-      - name: student_id
-        type: varchar(32)
-        comment: 家庭ID
-        not_null: true
-        index: true
-      - name: created_time
-        type: "timestamp with time zone"
-        comment: 创建时间
-        not_null: true
-      - name: last_updated_time
-        type: "timestamp with time zone"
-        comment: 最近更新时间
-        not_null: true

+ 0 - 25
examples/examples/project/deployment/data_service/data_containers/identity.yaml

@@ -1,25 +0,0 @@
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.identities
-  spec:
-    table_name: test.identities
-    columns:
-      - name: id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: name
-        type: varchar(128)
-        comment: 名称
-        not_null: true
-        index: true
-      - name: created_time
-        type: "timestamp with time zone"
-        comment: 创建时间
-        not_null: true
-      - name: last_updated_time
-        type: "timestamp with time zone"
-        comment: 最近更新时间
-        not_null: true

+ 0 - 35
examples/examples/project/deployment/data_service/data_containers/student.yaml

@@ -1,35 +0,0 @@
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.students
-  spec:
-    table_name: test.students
-    columns:
-      - name: id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: name
-        type: varchar(128)
-        comment: 姓名
-        not_null: true
-        index: true
-      - name: class_id
-        type: varchar(32)
-        comment: 班级ID
-        not_null: true
-        index: true
-      - name: family_id
-        type: varchar(32)
-        comment: 家庭ID
-        not_null: true
-        index: true
-      - name: created_time
-        type: "timestamp with time zone"
-        comment: 创建时间
-        not_null: true
-      - name: last_updated_time
-        type: "timestamp with time zone"
-        comment: 最近更新时间
-        not_null: true

+ 0 - 16
examples/examples/project/deployment/data_service/data_containers/student_and_hobby.yaml

@@ -1,16 +0,0 @@
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.student_and_hobby
-  spec:
-    table_name: test.student_and_hobby
-    columns:
-      - name: student_id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: hobby_id
-        type: varchar(32)
-        comment: id
-        primary_key: true

+ 0 - 16
examples/examples/project/deployment/data_service/data_containers/student_and_identity.yaml

@@ -1,16 +0,0 @@
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.student_and_identity
-  spec:
-    table_name: test.student_and_identity
-    columns:
-      - name: student_id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: identity_id
-        type: varchar(32)
-        comment: id
-        primary_key: true

+ 0 - 9
examples/examples/project/deployment/data_service/delete_data_containers.ps1

@@ -1,9 +0,0 @@
-Set-Location  $(Split-Path $MyInvocation.MyCommand.Path -Parent)
-
-datactl.exe delete -f base.yaml
-
-foreach ($file in $(Get-ChildItem -Path ".\data_containers")) {
-    if ($file.GetType() -eq [System.IO.FileInfo]) {
-        datactl.exe apply -f $file.FullName
-    }
-}

+ 0 - 10
examples/examples/project/deployment/data_service/delete_data_containers.sh

@@ -1,10 +0,0 @@
-#!/bin/bash
-cd "$(dirname "$0")" || exit 1
-
-datactl delete -f base.yaml
-
-for file in ./data_containers/*; do
-	if [ -f "$file" ]; then
-		datactl apply -f "$file"
-	fi
-done

+ 0 - 100
examples/examples/project/main.go

@@ -1,100 +0,0 @@
-package main
-
-import (
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application"
-	DEATH "github.com/vrecan/death"
-	"syscall"
-)
-
-// Version
-// curl -X GET "http://localhost:31000/example/api/version"
-
-// Configuration
-// curl -X POST -H "Content-Type: application/json" -d '{"scope": "global", "group":"test", "value":"test-value"}' "http://localhost:31000/example/api/configuration/create"
-// curl -X GET "http://localhost:31000/example/api/configuration/values?scope=global&group=test&pageNo=1&pageSize=1"
-// curl -X POST -H "Content-Type: application/json" -d '{"scope": "global", "group":"test"}' "http://localhost:31000/example/api/configuration/delete"
-
-// Class
-// curl -X POST -H "Content-Type: application/json" -d '{"name":"test", "studentNum": 10}' "http://localhost:31000/example/api/v1/class/create"
-// curl -X PUT -H "Content-Type: application/json" -d '{"id":"b96c97e868c94250a754e8f9f91518b7", "name":"test-new"}' "http://localhost:31000/example/api/v1/class/update"
-// curl -X GET "http://localhost:31000/example/api/v1/class/query?name=test-new&pageNo=1&pageSize=1"
-// curl -X GET "http://localhost:31000/example/api/v1/class/get?id=b96c97e868c94250a754e8f9f91518b7"
-// curl -X DELETE "http://localhost:31000/example/api/v1/class/delete?id=b96c97e868c94250a754e8f9f91518b7"
-
-// Student
-// curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:31000/example/api/v1/student/create"
-// curl -X PUT -H "Content-Type: application/json" -d '{"id":"d9332801b46c4f0c99fdd381954313d6", "name":"test-new"}' "http://localhost:31000/example/api/v1/student/update"
-// curl -X GET "http://localhost:31000/example/api/v1/student/query?name=test-new&pageNo=1&pageSize=1"
-// curl -X GET "http://localhost:31000/example/api/v1/student/get?id=d9332801b46c4f0c99fdd381954313d6"
-// curl -X DELETE "http://localhost:31000/example/api/v1/student/delete?id=d9332801b46c4f0c99fdd381954313d6"
-
-// Family
-// curl -X POST -H "Content-Type: application/json" -d '{"father":"father", "mother": "mother"}' "http://localhost:31000/example/api/v1/family/create"
-// curl -X PUT -H "Content-Type: application/json" -d '{"id":"85ffbfbef27b42879382b47718c7a99e", "father":"new-father", "mother": "new-mother"}' "http://localhost:31000/example/api/v1/family/update"
-// curl -X GET "http://localhost:31000/example/api/v1/family/query?father=new-father&pageNo=0&pageSize=0"
-// curl -X GET "http://localhost:31000/example/api/v1/family/get?id=85ffbfbef27b42879382b47718c7a99e"
-// curl -X DELETE "http://localhost:31000/example/api/v1/family/delete?id=85ffbfbef27b42879382b47718c7a99e"
-
-// Identity
-// curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:31000/example/api/v1/identity/create"
-// curl -X PUT -H "Content-Type: application/json" -d '{"id":"6e12ee71397746b8920fa94e5f229366", "name":"test-new"}' "http://localhost:31000/example/api/v1/identity/update"
-// curl -X GET "http://localhost:31000/example/api/v1/identity/query?name=test-new&pageNo=1&pageSize=1"
-// curl -X GET "http://localhost:31000/example/api/v1/identity/get?id=6e12ee71397746b8920fa94e5f229366"
-// curl -X DELETE "http://localhost:31000/example/api/v1/identity/delete?id=6e12ee71397746b8920fa94e5f229366"
-
-// Class-Student
-// curl -X POST -H "Content-Type: application/json" -d '{"id":"a38786c698904224a6fc36a23c2eec1e", "studentIds": ["00254b4a7102429db35e6edc8e47a764"]}' "http://localhost:31000/example/api/v1/class/student/update"
-// curl -X GET "http://localhost:31000/example/api/v1/class/student/query?id=a38786c698904224a6fc36a23c2eec1e"
-
-// Student-Class
-// curl -X POST -H "Content-Type: application/json" -d '{"id":"00254b4a7102429db35e6edc8e47a764", "classId": "a38786c698904224a6fc36a23c2eec1e"}' "http://localhost:31000/example/api/v1/student/class/update"
-// curl -X GET "http://localhost:31000/example/api/v1/student/class/query?id=00254b4a7102429db35e6edc8e47a764"
-// curl -X GET "http://localhost:31000/example/api/v1/student/class/queryWith?name=test"
-
-// Student-Family
-// curl -X POST -H "Content-Type: application/json" -d '{"id":"00254b4a7102429db35e6edc8e47a764", "familyId": "df3aeee04ce94c17878bbb5383d15f18"}' "http://localhost:31000/example/api/v1/student/family/update"
-// curl -X GET "http://localhost:31000/example/api/v1/student/family/query?id=00254b4a7102429db35e6edc8e47a764"
-// curl -X GET "http://localhost:31000/example/api/v1/student/family/queryWith?father=test"
-
-// Family-Student
-// curl -X POST -H "Content-Type: application/json" -d '{"id":"df3aeee04ce94c17878bbb5383d15f18", "studentId": "00254b4a7102429db35e6edc8e47a764"}' "http://localhost:31000/example/api/v1/family/student/update"
-// curl -X GET "http://localhost:31000/example/api/v1/family/student/query?id=df3aeee04ce94c17878bbb5383d15f18"
-// curl -X GET "http://localhost:31000/example/api/v1/family/student/queryWith?father=test"
-
-// Student-Identity
-// curl -X POST -H "Content-Type: application/json" -d '{"id":"00254b4a7102429db35e6edc8e47a764", "identityIds": ["4481fd110a5f46d2babe52b650981384"]}' "http://localhost:31000/example/api/v1/student/identity/update"
-// curl -X GET "http://localhost:31000/example/api/v1/student/identity/query?id=00254b4a7102429db35e6edc8e47a764"
-
-// Identity-Student
-// curl -X POST -H "Content-Type: application/json" -d '{"id":"4481fd110a5f46d2babe52b650981384", "studentIds": ["00254b4a7102429db35e6edc8e47a764"]}' "http://localhost:31000/example/api/v1/identity/student/update"
-// curl -X GET "http://localhost:31000/example/api/v1/identity/student/query?id=4481fd110a5f46d2babe52b650981384"
-
-// Student-Hobby
-// curl -X POST -H "Content-Type: application/json" -d '{"id":"a3f28141a96e4cec850b485bd9c38813", "hobbyIds": ["42b305bb292c4082a3e91a2967f11111"]}' "http://localhost:31000/example/api/v1/student/hobby/update"
-// curl -X GET "http://localhost:31000/example/api/v1/student/hobby/query?id=a3f28141a96e4cec850b485bd9c38813"
-
-// Hobby-Student
-// curl -X POST -H "Content-Type: application/json" -d '{"id":"42b305bb292c4082a3e91a2967f11111", "studentIds": ["00254b4a7102429db35e6edc8e47a764"]}' "http://localhost:31000/example/api/v1/hobby/student/update"
-// curl -X GET "http://localhost:31000/example/api/v1/hobby/student/query?id=42b305bb292c4082a3e91a2967f11111"
-
-func main() {
-	application.NewApp()
-	defer application.DestroyApp()
-
-	go func() {
-		err := application.Start()
-		if err != nil {
-			panic(err)
-		}
-	}()
-
-	defer func() {
-		err := application.Finish()
-		if err != nil {
-			panic(err)
-		}
-	}()
-
-	death := DEATH.NewDeath(syscall.SIGINT, syscall.SIGTERM)
-	_ = death.WaitForDeath()
-}

+ 0 - 83
examples/examples/project/test/configuration_test.go

@@ -1,83 +0,0 @@
-package test
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/domain/configuration"
-	"git.sxidc.com/go-framework/baize/framework/binding/response"
-	"git.sxidc.com/go-tools/utils/strutils"
-	"net/http"
-	"testing"
-)
-
-func TestConfiguration(t *testing.T) {
-	Init()
-	defer Destroy()
-
-	scope := strutils.SimpleUUID()
-	group := strutils.SimpleUUID()
-	value := strutils.SimpleUUID()
-
-	values := make([]string, 0)
-
-	NewToolKit(t).CreateConfiguration(scope, group, value).
-		GetConfigurationValues(scope, group, &values).
-		AssertEqual(1, len(values), "值的长度不正确").
-		AssertEqual(value, values[0], "值不正确").
-		DeleteConfiguration(scope, group).
-		GetConfigurationValues(scope, group, &values).
-		AssertEqual(0, len(values), "值的长度不正确")
-}
-
-func (toolKit *ToolKit) CreateConfiguration(scope string, group string, value string) *ToolKit {
-	msgResponse := new(response.MsgResponse)
-
-	toolKit.SetHeader("Content-Type", "application/json").
-		SetJsonBody(&configuration.AddConfigurationJsonBody{
-			Scope: scope,
-			Group: group,
-			Value: value,
-		}).
-		SetJsonResponse(msgResponse).
-		Request("/example/api/configuration/create", http.MethodPost).
-		AssertStatusCode(http.StatusOK).
-		AssertEqual(true, msgResponse.Success, msgResponse.Msg)
-
-	return toolKit
-}
-
-func (toolKit *ToolKit) DeleteConfiguration(scope string, group string) *ToolKit {
-	msgResponse := new(response.MsgResponse)
-
-	toolKit.SetHeader("Content-Type", "application/json").
-		SetJsonResponse(msgResponse).
-		SetJsonBody(&configuration.RemoveConfigurationJsonBody{
-			Scope: scope,
-			Group: group,
-		}).
-		Request("/example/api/configuration/delete", http.MethodPost).
-		AssertStatusCode(http.StatusOK).
-		AssertEqual(true, msgResponse.Success, msgResponse.Msg)
-
-	return toolKit
-}
-
-func (toolKit *ToolKit) GetConfigurationValues(scope string, group string, retValues *[]string) *ToolKit {
-	getConfigurationValuesResponse := new(struct {
-		response.MsgResponse
-		Values []string `json:"values"`
-	})
-
-	toolKit.SetHeader("Content-Type", "application/json").
-		SetJsonResponse(getConfigurationValuesResponse).
-		SetQueryParams("scope", scope).
-		SetQueryParams("group", group).
-		Request("/example/api/configuration/values", http.MethodGet).
-		AssertStatusCode(http.StatusOK).
-		AssertEqual(true, getConfigurationValuesResponse.Success, getConfigurationValuesResponse.Msg)
-
-	if retValues != nil {
-		*retValues = make([]string, 0)
-		*retValues = getConfigurationValuesResponse.Values
-	}
-
-	return toolKit
-}

+ 0 - 186
examples/examples/project/test/tool_kit.go

@@ -1,186 +0,0 @@
-package test
-
-import (
-	"bytes"
-	"encoding/json"
-	"git.sxidc.com/go-framework/baize/examples/examples/project/application"
-	"git.sxidc.com/go-tools/utils/strutils"
-	"github.com/stretchr/testify/assert"
-	"io"
-	"net/http"
-	"net/http/httptest"
-	"reflect"
-	"testing"
-	"time"
-)
-
-type ToolKit struct {
-	t *testing.T
-
-	body         io.Reader
-	header       map[string]string
-	queryParams  map[string]string
-	jsonResponse interface{}
-	token        string
-
-	responseRecorder *httptest.ResponseRecorder
-}
-
-func Init() {
-	application.NewApp()
-
-	go func() {
-		err := application.Start()
-		if err != nil {
-			panic(err)
-		}
-	}()
-
-	time.Sleep(100 * time.Millisecond)
-}
-
-func Destroy() {
-	err := application.Finish()
-	if err != nil {
-		panic(err)
-	}
-
-	application.DestroyApp()
-}
-
-func NewToolKit(t *testing.T) *ToolKit {
-	return &ToolKit{
-		t:           t,
-		header:      make(map[string]string),
-		queryParams: make(map[string]string),
-	}
-}
-
-func (toolKit *ToolKit) SetHeader(key string, value string) *ToolKit {
-	toolKit.header[key] = value
-	return toolKit
-}
-
-func (toolKit *ToolKit) SetBody(body *bytes.Buffer) *ToolKit {
-	toolKit.body = body
-	return toolKit
-}
-
-func (toolKit *ToolKit) SetQueryParams(key string, value string) *ToolKit {
-	toolKit.queryParams[key] = value
-	return toolKit
-}
-
-func (toolKit *ToolKit) SetJsonBody(body interface{}) *ToolKit {
-	jsonBody, err := json.Marshal(body)
-	if err != nil {
-		toolKit.t.Fatal("转换JSON失败")
-	}
-
-	toolKit.body = bytes.NewBuffer(jsonBody)
-
-	return toolKit
-}
-
-func (toolKit *ToolKit) SetJsonResponse(response interface{}) *ToolKit {
-	if response == nil {
-		toolKit.jsonResponse = nil
-		return toolKit
-	}
-
-	responseValue := reflect.ValueOf(response)
-	if responseValue.Kind() != reflect.Ptr {
-		toolKit.t.Fatal("JsonResponse应该传递指针类型")
-	}
-
-	toolKit.jsonResponse = response
-
-	return toolKit
-}
-
-func (toolKit *ToolKit) SetToken(token string) *ToolKit {
-	toolKit.token = token
-	return toolKit
-}
-
-func (toolKit *ToolKit) Request(url string, method string) *ToolKit {
-	if len(toolKit.queryParams) != 0 {
-		url = url + "?"
-		for key, value := range toolKit.queryParams {
-			url = url + key + "=" + value + "&"
-		}
-
-		url = url[:len(url)-1]
-
-		toolKit.queryParams = make(map[string]string)
-	}
-
-	request, err := http.NewRequest(method, url, toolKit.body)
-	if err != nil {
-		toolKit.t.Fatal("创建请求失败", err)
-	}
-
-	if len(toolKit.header) != 0 {
-		for key, value := range toolKit.header {
-			request.Header.Add(key, value)
-		}
-
-		toolKit.header = make(map[string]string)
-	}
-
-	if !strutils.IsStringEmpty(toolKit.token) {
-		request.Header.Add("Authorization", toolKit.token)
-	}
-
-	toolKit.responseRecorder = httptest.NewRecorder()
-	application.ServerHttpForTest(toolKit.responseRecorder, request)
-
-	if toolKit.responseRecorder.Code == http.StatusOK && toolKit.jsonResponse != nil {
-		responseBody, err := io.ReadAll(toolKit.responseRecorder.Body)
-		if err != nil {
-			toolKit.t.Fatal("读取响应Body失败")
-		}
-
-		err = json.Unmarshal(responseBody, toolKit.jsonResponse)
-		if err != nil {
-			toolKit.t.Fatal("转换Response失败")
-		}
-	}
-
-	return toolKit
-}
-
-func (toolKit *ToolKit) AssertStatusCode(code int) *ToolKit {
-	assert.Equal(toolKit.t, code, toolKit.responseRecorder.Code)
-	return toolKit
-}
-
-func (toolKit *ToolKit) AssertBodyEqual(body string) *ToolKit {
-	assert.Equal(toolKit.t, body, toolKit.responseRecorder.Body.String())
-	return toolKit
-}
-
-func (toolKit *ToolKit) AssertEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) *ToolKit {
-	assert.Equal(toolKit.t, expected, actual, msgAndArgs)
-	return toolKit
-}
-
-func (toolKit *ToolKit) AssertNotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) *ToolKit {
-	assert.NotEqual(toolKit.t, expected, actual, msgAndArgs)
-	return toolKit
-}
-
-func (toolKit *ToolKit) AssertNotEmpty(object interface{}, msgAndArgs ...interface{}) *ToolKit {
-	assert.NotEmpty(toolKit.t, object, msgAndArgs)
-	return toolKit
-}
-
-func (toolKit *ToolKit) AssertGreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) *ToolKit {
-	assert.GreaterOrEqual(toolKit.t, e1, e2, msgAndArgs)
-	return toolKit
-}
-
-func (toolKit *ToolKit) AssertZero(e1 interface{}, msgAndArgs ...interface{}) *ToolKit {
-	assert.Zero(toolKit.t, e1, msgAndArgs)
-	return toolKit
-}

+ 0 - 20
examples/examples/project/test/version_test.go

@@ -1,20 +0,0 @@
-package test
-
-import (
-	"net/http"
-	"testing"
-)
-
-func TestVersion(t *testing.T) {
-	Init()
-	defer Destroy()
-
-	versionResponse := &struct {
-		Version string `json:"version"`
-	}{}
-
-	NewToolKit(t).SetJsonResponse(versionResponse).
-		Request("/example/api/version", http.MethodGet).
-		AssertStatusCode(http.StatusOK).
-		AssertEqual(versionResponse.Version, "v1.0.0")
-}

+ 0 - 102
examples/examples/quick_start/main.go

@@ -1,102 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"git.sxidc.com/go-framework/baize"
-	"git.sxidc.com/go-framework/baize/framework/api"
-	"git.sxidc.com/go-framework/baize/framework/application"
-	"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/domain"
-	"git.sxidc.com/go-framework/baize/framework/infrastructure"
-	DEATH "github.com/vrecan/death"
-	"net/http"
-	"syscall"
-)
-
-func main() {
-	app := baize.NewApplication(application.Config{
-		ApiConfig: application.ApiConfig{
-			UrlPrefix: "test",
-			Port:      "10100",
-		},
-	})
-
-	app.Api().
-		RootRouter().
-		AddMiddlewares(func(c *api.Context) {
-			fmt.Println("Global Before1")
-			c.Next()
-			fmt.Println("Global After1")
-		}, func(c *api.Context) {
-			fmt.Println("Global Before2")
-			c.Next()
-			fmt.Println("Global After2")
-		})
-
-	rootBinder := app.Binder(application.RouterRoot, "")
-
-	binding.GetBind(rootBinder, &binding.SimpleBindItem[any]{
-		Path:         "/ping",
-		ResponseFunc: response.NoResponse,
-		ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
-			c.String(http.StatusOK, "pong")
-			return nil, nil
-		},
-	}, func(c *api.Context) {
-		fmt.Println("Root Route Before1")
-		c.Next()
-		fmt.Println("Root Route After1")
-	}, func(c *api.Context) {
-		fmt.Println("Root Route Before2")
-		c.Next()
-		fmt.Println("Root Route After2")
-	})
-
-	app.Api().
-		PrefixRouter().
-		RegisterVersionedRouter("v1", func(c *api.Context) {
-			fmt.Println("Global Before1")
-			c.Next()
-			fmt.Println("Global After1")
-		}, func(c *api.Context) {
-			fmt.Println("Global Before2")
-			c.Next()
-			fmt.Println("Global After2")
-		})
-
-	prefixRootBinder := app.Binder(application.RouterPrefix, "v1")
-
-	binding.GetBind(prefixRootBinder, &binding.SimpleBindItem[any]{
-		Path:         "/ping",
-		ResponseFunc: response.NoResponse,
-		ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
-			c.String(http.StatusOK, "pong")
-			return nil, nil
-		},
-	}, func(c *api.Context) {
-		fmt.Println("Versioned Route Before1")
-		c.Next()
-		fmt.Println("Versioned Route After1")
-	}, func(c *api.Context) {
-		fmt.Println("Versioned Route Before2")
-		c.Next()
-		fmt.Println("Versioned Route After2")
-	})
-
-	go func() {
-		if err := app.Start(); err != nil {
-			panic(err)
-		}
-	}()
-
-	defer func() {
-		if err := app.Finish(); err != nil {
-			panic(err)
-		}
-	}()
-
-	death := DEATH.NewDeath(syscall.SIGINT, syscall.SIGTERM)
-	_ = death.WaitForDeath()
-}

+ 0 - 51
examples/examples/sql_mapping_tag/main.go

@@ -1,51 +0,0 @@
-package main
-
-import (
-	"fmt"
-	sql_mapping2 "git.sxidc.com/go-framework/baize/framework/core/tag/sql/sql_mapping"
-	"reflect"
-	"time"
-)
-
-type IDField struct {
-	ID string
-}
-
-type TimeFields struct {
-	CreatedTime     *time.Time
-	LastUpdatedTime time.Time
-}
-
-type GraduatedTimeTestStruct struct {
-	Field *string `sqlmapping:"-"`
-}
-
-type Class struct {
-	IDField
-	Name          string `sqlmapping:"updateClear;aes:@MKU^AHYCN$:j76J<TAHCVD#$XZSWQ@L;"`
-	StudentNum    int    `sqlmapping:"column:student_num;notUpdate;"`
-	GraduatedTime *time.Time
-	StudentIDs    []string `sqlmapping:"column:student_ids;joinWith:'\n'"`
-	TimeFields
-	Ignored string `sqlmapping:"-"`
-	*GraduatedTimeTestStruct
-}
-
-func main() {
-	err := sql_mapping2.UseTag(&Class{}, func(fieldName string, entityFieldElemValue reflect.Value, sqlMappingTag *sql_mapping2.Tag) error {
-		fmt.Println("Field Name:", fieldName)
-		fmt.Println("Type:", entityFieldElemValue.Type().String())
-		if entityFieldElemValue.Kind() == reflect.String {
-			fmt.Printf("\"%+v\"\n", entityFieldElemValue.Interface())
-		} else {
-			fmt.Printf("%+v\n", entityFieldElemValue.Interface())
-		}
-		fmt.Printf("%+v\n", sqlMappingTag)
-		fmt.Println()
-
-		return nil
-	})
-	if err != nil {
-		panic(err)
-	}
-}

+ 0 - 51
examples/examples/sql_result_tag/main.go

@@ -1,51 +0,0 @@
-package main
-
-import (
-	"fmt"
-	sql_result2 "git.sxidc.com/go-framework/baize/framework/core/tag/sql/sql_result"
-	"reflect"
-	"time"
-)
-
-type IDField struct {
-	ID string
-}
-
-type TimeFields struct {
-	CreatedTime     *time.Time
-	LastUpdatedTime time.Time
-}
-
-type GraduatedTimeTestStruct struct {
-	Field *string `sqlresult:"column:graduated_time;parseTime:2006-01-02 15:04:05"`
-}
-
-type Class struct {
-	IDField
-	Name          string `sqlresult:"aes:@MKU^AHYCN$:j76J<TAHCVD#$XZSWQ@L;"`
-	StudentNum    int    `sqlresult:"column:student_num_alias"`
-	GraduatedTime *time.Time
-	StudentIDs    []string `sqlresult:"column:student_ids;splitWith:'\n'"`
-	TimeFields
-	Ignored string `sqlresult:"-"`
-	*GraduatedTimeTestStruct
-}
-
-func main() {
-	err := sql_result2.UseTag(&Class{}, func(fieldName string, entityFieldElemValue reflect.Value, sqlResultTag *sql_result2.Tag) error {
-		fmt.Println("Field Name:", fieldName)
-		fmt.Println("Type:", entityFieldElemValue.Type().String())
-		if entityFieldElemValue.Kind() == reflect.String {
-			fmt.Printf("\"%+v\"\n", entityFieldElemValue.Interface())
-		} else {
-			fmt.Printf("%+v\n", entityFieldElemValue.Interface())
-		}
-		fmt.Printf("%+v\n", sqlResultTag)
-		fmt.Println()
-
-		return nil
-	})
-	if err != nil {
-		panic(err)
-	}
-}

+ 2 - 2
framework/core/infrastructure/database/operations/operations.go

@@ -4,8 +4,8 @@ import (
 	dbSql "database/sql"
 	"encoding/json"
 	"git.sxidc.com/go-framework/baize/framework/core/infrastructure/database/sql"
+	"git.sxidc.com/go-framework/baize/framework/core/infrastructure/logger"
 	"git.sxidc.com/go-tools/utils/template"
-	"git.sxidc.com/service-supports/fslog"
 	"gorm.io/gorm"
 	"time"
 )
@@ -90,7 +90,7 @@ func (op *Operations) startBeatHeart(sqlDB *dbSql.DB) {
 			case <-pingTicker.C:
 				err := sqlDB.Ping()
 				if err != nil {
-					fslog.Error(err)
+					logger.GetInstance().Error(err)
 				}
 			}
 		}

+ 1 - 8
go.mod

@@ -5,15 +5,11 @@ go 1.22.3
 require (
 	git.sxidc.com/go-tools/utils v1.5.14
 	git.sxidc.com/service-supports/fserr v0.3.5
-	git.sxidc.com/service-supports/fslog v0.5.9
-	git.sxidc.com/service-supports/scm-sdk v0.1.0
 	git.sxidc.com/service-supports/websocket v1.3.1
 	github.com/gin-gonic/gin v1.10.0
 	github.com/golang/protobuf v1.5.4
 	github.com/iancoleman/strcase v0.3.0
 	github.com/mwitkow/go-proto-validators v0.3.2
-	github.com/stretchr/testify v1.9.0
-	github.com/vrecan/death v3.0.1+incompatible
 	go.uber.org/zap v1.27.0
 	google.golang.org/grpc v1.64.0
 	google.golang.org/protobuf v1.34.1
@@ -24,15 +20,14 @@ require (
 )
 
 require (
+	git.sxidc.com/service-supports/fslog v0.5.9 // indirect
 	github.com/Masterminds/goutils v1.1.1 // indirect
 	github.com/Masterminds/semver/v3 v3.2.0 // indirect
 	github.com/Masterminds/sprig/v3 v3.2.3 // indirect
 	github.com/bytedance/sonic v1.11.6 // indirect
 	github.com/bytedance/sonic/loader v0.1.1 // indirect
-	github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect
 	github.com/cloudwego/base64x v0.1.4 // indirect
 	github.com/cloudwego/iasm v0.2.0 // indirect
-	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/gabriel-vasile/mimetype v1.4.3 // indirect
 	github.com/gin-contrib/sse v0.1.0 // indirect
 	github.com/go-playground/locales v0.14.1 // indirect
@@ -60,12 +55,10 @@ require (
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/olahol/melody v1.2.1 // indirect
 	github.com/pelletier/go-toml/v2 v2.2.2 // indirect
-	github.com/pmezard/go-difflib v1.0.0 // indirect
 	github.com/puzpuzpuz/xsync v1.5.2 // indirect
 	github.com/rogpeppe/go-internal v1.12.0 // indirect
 	github.com/satori/go.uuid v1.2.0 // indirect
 	github.com/shopspring/decimal v1.2.0 // indirect
-	github.com/smartystreets/goconvey v1.8.1 // indirect
 	github.com/spf13/cast v1.3.1 // indirect
 	github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
 	github.com/ugorji/go/codec v1.2.12 // indirect

+ 0 - 14
go.sum

@@ -4,8 +4,6 @@ git.sxidc.com/service-supports/fserr v0.3.5 h1:1SDC60r3FIDd2iRq/oHRLK4OMa1gf67h9
 git.sxidc.com/service-supports/fserr v0.3.5/go.mod h1:8U+W/ulZIGVPFojV6cE18shkGXqvaICuzaxIJpOcBqI=
 git.sxidc.com/service-supports/fslog v0.5.9 h1:q2XIK2o/fk/qmByy4x5kKLC+k7kolT5LrXHcWRSffXQ=
 git.sxidc.com/service-supports/fslog v0.5.9/go.mod h1:/m03ATmmOle75qtEgvEw8a1+Dcg6iHp08M1bGFXJTBU=
-git.sxidc.com/service-supports/scm-sdk v0.1.0 h1:198qs/XxffOrHioKEWXyPfsQLoO3E8Ifj4idOWJxIe0=
-git.sxidc.com/service-supports/scm-sdk v0.1.0/go.mod h1:F0DLFok92zElZZRxJujSk6KmRoVGN8bkrbXFdq19uwI=
 git.sxidc.com/service-supports/websocket v1.3.1 h1:1mRfUwvpg0QA2JVKVMK8YJ/B33HFpDhY9srqroIuNGc=
 git.sxidc.com/service-supports/websocket v1.3.1/go.mod h1:YqEZXkN8ZFzUp01tDlekgIJJ0Yz+67d6eTXyA0ZIkgM=
 github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
@@ -18,8 +16,6 @@ github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc
 github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
 github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
 github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
-github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 h1:kHaBemcxl8o/pQ5VM1c8PVE1PubbNx3mjUr09OqWGCs=
-github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575/go.mod h1:9d6lWj8KzO/fd/NrVaLscBKmPigpZpn5YawRPw+e3Yo=
 github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
 github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
 github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
@@ -56,8 +52,6 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
 github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
 github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
-github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
 github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
 github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
 github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4=
@@ -78,8 +72,6 @@ github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
 github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
 github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
 github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
-github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
-github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
 github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
 github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
@@ -119,10 +111,6 @@ github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
 github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
 github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
 github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
-github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY=
-github.com/smarty/assertions v1.15.0/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec=
-github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY=
-github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60=
 github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
 github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -143,8 +131,6 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
 github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
 github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
 github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
-github.com/vrecan/death v3.0.1+incompatible h1:hYRRqrdyoUAbymk2KJ8tNHmZFKcVeThRUySCqwC5Itg=
-github.com/vrecan/death v3.0.1+incompatible/go.mod h1:ektTae4lwvcXJ7pytrLb2N0w7mwhzmu+f5vRHYzy33E=
 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
 go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=