Parcourir la source

调整关联的选项

yjp il y a 1 an
Parent
commit
5a048c1ce2

+ 2 - 38
convenient/relation/many2many/simple.go

@@ -19,10 +19,10 @@ type Simple[LI any, RI any] struct {
 	// 中间表表名
 	MiddleTableName string
 
-	// URL领域相对路径,如/person/identities,后面会自动补充,如/person/identities/update
+	// URL领域相对路径,如/person,后面会自动补充,如/user/右领域path/update
 	LeftDomainPath string
 
-	// URL领域相对路径,如/identity/persons,后面会自动补充,如/identity/persons/update
+	// URL领域相对路径,如/identity,后面会自动补充,如/userInfo/左领域path/update
 	RightDomainPath string
 
 	// 更新左实体关联使用的请求参数
@@ -61,18 +61,6 @@ func BindSimple[LI any, RI any](binder *binding.Binder, simple *Simple[LI, RI],
 type Option func(options *Options)
 
 type Options struct {
-	// 左实体中指向右实体的字段
-	leftRelationField string
-
-	// 右实体中指向左实体的字段
-	rightRelationField string
-
-	// 左实体中指向右实体的列名
-	leftRelationColumn string
-
-	// 右实体中指向左实体的列名
-	rightRelationColumn string
-
 	// 关闭左侧到右侧关联
 	disableLeft bool
 
@@ -92,30 +80,6 @@ type Options struct {
 	disableRightQuery bool
 }
 
-func WithLeftRelationField(leftRelationField string) Option {
-	return func(options *Options) {
-		options.leftRelationField = leftRelationField
-	}
-}
-
-func WithRightRelationField(rightRelationField string) Option {
-	return func(options *Options) {
-		options.rightRelationField = rightRelationField
-	}
-}
-
-func WithLeftRelationColumn(leftRelationColumn string) Option {
-	return func(options *Options) {
-		options.leftRelationColumn = leftRelationColumn
-	}
-}
-
-func WithRightRelationColumn(rightRelationColumn string) Option {
-	return func(options *Options) {
-		options.rightRelationColumn = rightRelationColumn
-	}
-}
-
 func WithDisableLeft() Option {
 	return func(options *Options) {
 		options.disableLeft = true

+ 2 - 20
convenient/relation/one2many/simple.go

@@ -22,10 +22,10 @@ type Simple[LI any, RI any] struct {
 	// 右表名
 	RightTableName string
 
-	// URL领域相对路径,如/class/students,后面会自动补充,如/class/students/update
+	// URL领域相对路径,如/class,后面会自动补充,如/class/右领域path/update
 	LeftDomainPath string
 
-	// URL领域相对路径,如/student/classes,后面会自动补充,如/student/classes/update
+	// URL领域相对路径,如/student,后面会自动补充,如/student/左领域path/update
 	RightDomainPath string
 
 	// 更新左实体关联使用的请求参数
@@ -67,12 +67,6 @@ func BindSimple[LI any, RI any](binder *binding.Binder, simple *Simple[LI, RI],
 type Option func(options *Options)
 
 type Options struct {
-	// 右实体中指向左实体的字段
-	rightRelationField string
-
-	// 右实体中指向左实体的列名
-	rightRelationColumn string
-
 	// 关闭左侧到右侧关联
 	disableLeft bool
 
@@ -95,18 +89,6 @@ type Options struct {
 	disableRightWithLeftQuery bool
 }
 
-func WithRightRelationField(rightRelationField string) Option {
-	return func(options *Options) {
-		options.rightRelationField = rightRelationField
-	}
-}
-
-func WithRightRelationColumn(rightRelationColumn string) Option {
-	return func(options *Options) {
-		options.rightRelationColumn = rightRelationColumn
-	}
-}
-
 func WithDisableLeft() Option {
 	return func(options *Options) {
 		options.disableLeft = true

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

@@ -25,10 +25,10 @@ type Simple[LI any, RI any] struct {
 	// 右表名,只存在单侧表,赋值空即可
 	RightTableName string
 
-	// URL领域相对路径,如/user/userInfo,后面会自动补充,如/user/userInfo/update
+	// URL领域相对路径,如/user,后面会自动补充,如/user/右领域path/update
 	LeftDomainPath string
 
-	// URL领域相对路径,如/userInfo/user,后面会自动补充,如/userInfo/user/update
+	// URL领域相对路径,如/userInfo,后面会自动补充,如/userInfo/左领域path/update
 	RightDomainPath string
 
 	// 更新左实体关联使用的请求参数