You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
681 B
33 lines
681 B
package model |
|
|
|
import ( |
|
"fmt" |
|
"strings" |
|
) |
|
|
|
const _teamMapInsertSQL = "INSERT INTO es_teams_map(tid,aid) VALUES %s" |
|
|
|
// TeamMap . |
|
type TeamMap struct { |
|
ID int64 `json:"id"` |
|
Tid int64 `json:"tid"` |
|
Aid int64 `json:"aid"` |
|
IsDeleted int `json:"is_deleted"` |
|
} |
|
|
|
// TableName es_teams_map. |
|
func (t TeamMap) TableName() string { |
|
return "es_teams_map" |
|
} |
|
|
|
// BatchAddTeamMapSQL . |
|
func BatchAddTeamMapSQL(data []*TeamMap) string { |
|
if len(data) == 0 { |
|
return "" |
|
} |
|
var rowStrings []string |
|
for _, v := range data { |
|
rowStrings = append(rowStrings, fmt.Sprintf("(%d,%d)", v.Tid, v.Aid)) |
|
} |
|
return fmt.Sprintf(_teamMapInsertSQL, strings.Join(rowStrings, ",")) |
|
}
|
|
|