|
|
@@ -25,10 +25,10 @@ type Simple[LI any, RI any] struct {
|
|
|
// 中间表表名
|
|
|
MiddleTableName string
|
|
|
|
|
|
- // URL领域相对路径,如/person/identities,后面会自动补充,如/person/identities/update
|
|
|
+ // URL领域相对路径,如/person,后面会自动补充,如/person/右领域path/update
|
|
|
LeftDomainPath string
|
|
|
|
|
|
- // URL领域相对路径,如/identity/persons,后面会自动补充,如/identity/persons/update
|
|
|
+ // URL领域相对路径,如/identity,后面会自动补充,如/identity/左领域path/update
|
|
|
RightDomainPath string
|
|
|
|
|
|
// 更新左实体关联使用的请求参数
|
|
|
@@ -67,18 +67,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
|
|
|
|
|
|
@@ -98,30 +86,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
|