|
|
@@ -12,7 +12,7 @@ import (
|
|
|
|
|
|
// Simple 关联的Bind参数
|
|
|
// I 为本地实体的Info类型
|
|
|
-type Simple[I any] struct {
|
|
|
+type Simple[LI any, RI any] struct {
|
|
|
// 左领域实体,注意是Entity类型
|
|
|
Left entity.Entity
|
|
|
|
|
|
@@ -44,7 +44,7 @@ type Simple[I any] struct {
|
|
|
options *Options
|
|
|
}
|
|
|
|
|
|
-func (simple *Simple[I]) bind(binder *binding.Binder) {
|
|
|
+func (simple *Simple[LI, RI]) bind(binder *binding.Binder) {
|
|
|
options := simple.options
|
|
|
|
|
|
leftDomainPath := domain.RelativeDomainPath(simple.Left)
|
|
|
@@ -84,12 +84,12 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
|
|
|
ServiceFunc: QueryToRemote(middleTableName, simple.LeftRemote, leftTableName, leftRelationColumnName, rightRelationColumnName),
|
|
|
})
|
|
|
} else {
|
|
|
- binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[I]]{
|
|
|
+ binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[RI]]{
|
|
|
Path: leftDomainPath + rightDomainPath + "/query",
|
|
|
- ResponseFunc: response.SendInfosResponse[I],
|
|
|
+ ResponseFunc: response.SendInfosResponse[RI],
|
|
|
RequestParams: simple.LeftQueryQueryParams,
|
|
|
Objects: []domain.Object{simple.Left},
|
|
|
- ServiceFunc: QueryToExist[I](middleTableName,
|
|
|
+ ServiceFunc: QueryToExist[RI](middleTableName,
|
|
|
simple.LeftRemote, leftTableName, leftRelationColumnName,
|
|
|
rightTableName, rightRelationColumnName),
|
|
|
})
|
|
|
@@ -122,12 +122,12 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
|
|
|
ServiceFunc: QueryToRemote(middleTableName, simple.RightRemote, rightTableName, rightRelationColumnName, leftRelationColumnName),
|
|
|
})
|
|
|
} else {
|
|
|
- binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[I]]{
|
|
|
+ binding.GetBind(binder, &binding.SimpleBindItem[response.InfosData[LI]]{
|
|
|
Path: rightDomainPath + leftDomainPath + "/query",
|
|
|
- ResponseFunc: response.SendInfosResponse[I],
|
|
|
+ ResponseFunc: response.SendInfosResponse[LI],
|
|
|
RequestParams: simple.RightQueryQueryParams,
|
|
|
Objects: []domain.Object{simple.Right},
|
|
|
- ServiceFunc: QueryToExist[I](middleTableName,
|
|
|
+ ServiceFunc: QueryToExist[LI](middleTableName,
|
|
|
simple.RightRemote, rightTableName, rightRelationColumnName,
|
|
|
leftTableName, leftRelationColumnName),
|
|
|
})
|
|
|
@@ -136,7 +136,7 @@ func (simple *Simple[I]) bind(binder *binding.Binder) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func BindSimple[I any](binder *binding.Binder, simple *Simple[I], opts ...Option) {
|
|
|
+func BindSimple[LI any, RI any](binder *binding.Binder, simple *Simple[LI, RI], opts ...Option) {
|
|
|
options := new(Options)
|
|
|
|
|
|
for _, opt := range opts {
|