MCPcopy Index your code
hub / github.com/TruthHun/DocHub / joinOn

Function joinOn

models/Models.go:449–471  ·  view source on GitHub ↗

只供LeftJoinSqlBuild创建SQL语句使用 @param table 需要左联查询的表 @param usedTables 已使用的表 @param on 联合查询条件 @return newon 新的联合查询条件(返回未被使用的联合查询条件) @return ret 返回组装联合查询条件

(table string, usedTables []string, on []map[string]string)

Source from the content-addressed store, hash-verified

447//@return newon 新的联合查询条件(返回未被使用的联合查询条件)
448//@return ret 返回组装联合查询条件
449func joinOn(table string, usedTables []string, on []map[string]string) (newon []map[string]string, ret string) {
450 table = table + "."
451 lenon := len(on)
452 for index, v := range on {
453 for key, val := range v {
454 if strings.HasPrefix(key, table) || strings.HasPrefix(val, table) {
455 for _, used := range usedTables {
456 if strings.HasPrefix(key, used) || strings.HasPrefix(val, used) {
457 ret = key + "=" + val
458 if index > 0 {
459 newon = append(newon, on[0:index]...)
460 }
461 if index+1 <= lenon {
462 newon = append(newon, on[(index+1):]...)
463 }
464 return
465 }
466 }
467 }
468 }
469 }
470 return
471}
472
473//替换写入【注意:表中必须要有一个除了主键外的唯一键】
474//@param table 需要写入的table

Callers 1

LeftJoinSqlBuildFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected