|
@@ -720,8 +720,12 @@ func newEntity(model Model, opts *Options) *Entity {
|
|
|
}
|
|
|
entity.lruCache, _ = lru.New(50)
|
|
|
entity.reflectType = entity.reflectValue.Type()
|
|
|
- entity.singularName = inflector.Singularize(model.TableName())
|
|
|
- entity.pluralizeName = inflector.Pluralize(model.TableName())
|
|
|
+ tableName := model.TableName()
|
|
|
+ if opts.RemoveTablePrefix && opts.TablePrefix != "" {
|
|
|
+ tableName = strings.TrimLeft(tableName, opts.TablePrefix)
|
|
|
+ }
|
|
|
+ entity.singularName = inflector.Singularize(tableName)
|
|
|
+ entity.pluralizeName = inflector.Pluralize(tableName)
|
|
|
|
|
|
val := reflect.New(entity.reflectType).Interface()
|
|
|
|