This commit is contained in:
Eden Kirin
2025-10-31 19:04:40 +01:00
parent ca10b01fb0
commit 4e4827d640
12 changed files with 2612 additions and 10 deletions

View File

@ -57,15 +57,11 @@ func GetRelationshipModuleName(tableName string) string {
}
// GetFilterFieldName returns the filter field name for a column
// For ID fields with IN operator, pluralizes the name
// For ID fields with IN operator, changes _id to _ids (e.g., machine_id -> machine_ids)
func GetFilterFieldName(columnName string, useIN bool) string {
if useIN && strings.HasSuffix(columnName, "_id") {
// Remove _id, pluralize, add back _ids
base := columnName[:len(columnName)-3]
if base == "" {
return "ids"
}
return naming.Pluralize(base) + "_ids"
// Replace _id with _ids
return columnName[:len(columnName)-2] + "ids"
}
if useIN && columnName == "id" {
return "ids"