ariga / entimport

A tool for generating Ent schema from SQL schema
Apache License 2.0
182 stars 55 forks source link

fix:table name may not be the same as in the database #41

Open xiiiew opened 2 years ago

xiiiew commented 2 years ago

When I use entimport to generate ent code, if the table name in the database ends with s, it will be trimmed. In order to make the generated code consistent with the database, it is recommended not to call this method.

for example, my table name is profit_and_loss, and the generated file name is profit_and_los.go

// old version
func typeName(tableName string) string {
    return inflect.Camelize(inflect.Singularize(tableName))
}

// new version
func typeName(tableName string) string {
    return inflect.Camelize(tableName)
}