|
|
@@ -312,7 +312,7 @@ func QueryRight[LI any](rightTableName string, rightRelationFieldName string, le
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-type ConditionFieldCallback func(conditions *sql.Conditions, fieldName string, columnName string, value any) (hasDeal bool)
|
|
|
+type ConditionFieldCallback func(conditions *sql.Conditions, fieldName string, columnName string, value any) (hasDeal bool, err error)
|
|
|
|
|
|
func QueryRightWithLeftInfo[RI any, LI any](rightTableName string, rightRelationColumnName string, rightFieldCallback ConditionFieldCallback, leftTableName string) binding.ServiceFunc[response.InfosData[map[string]any]] {
|
|
|
return func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (response.InfosData[map[string]any], error) {
|
|
|
@@ -351,7 +351,10 @@ func QueryRightWithLeftInfo[RI any, LI any](rightTableName string, rightRelation
|
|
|
for _, rightField := range rightFields {
|
|
|
hasDeal := false
|
|
|
if rightFieldCallback != nil {
|
|
|
- hasDeal = rightFieldCallback(conditions, rightField.FieldName, rightField.ColumnName, rightField.Value)
|
|
|
+ hasDeal, err = rightFieldCallback(conditions, rightField.FieldName, rightField.ColumnName, rightField.Value)
|
|
|
+ if err != nil {
|
|
|
+ return errResponse, err
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if !hasDeal {
|