(table, column string)
| 247 | } |
| 248 | |
| 249 | func (ns CustomizedNamingStrategy) ColumnName(table, column string) string { |
| 250 | baseColumnName := ns.NamingStrategy.ColumnName(table, column) |
| 251 | |
| 252 | if table == "" { |
| 253 | return baseColumnName |
| 254 | } |
| 255 | |
| 256 | s := strings.Split(table, "_") |
| 257 | |
| 258 | var prefix string |
| 259 | switch len(s) { |
| 260 | case 1: |
| 261 | prefix = s[0][:3] |
| 262 | case 2: |
| 263 | prefix = s[0][:1] + s[1][:2] |
| 264 | default: |
| 265 | prefix = s[0][:1] + s[1][:1] + s[2][:1] |
| 266 | } |
| 267 | return prefix + "_" + baseColumnName |
| 268 | } |
| 269 | |
| 270 | func TestEmbeddedStructForCustomizedNamingStrategy(t *testing.T) { |
| 271 | type CorpBase struct { |
nothing calls this directly
no test coverage detected