// generateTableNameFunction the function to set the gorm table name
// back to gorm default, removing "ORM" suffix
generateTableNameFunction the function to set the gorm table name
back to gorm default, removing "ORM" suffix
// generateTableNameFunction the function to set the gorm table name // back to gorm default removing " ORM " suffix
func (p *OrmPlugin) generateTableNameFunction(message pgs.Message) {
	typeName := p.TypeName(message)
	p.P(`// TableName overrides the default tablename generated by GORM`)
	p.P(`func (`, typeName, `ORM) TableName() string {`)
	tableName := inflection.Plural(jgorm.ToDBName(string(message.Name())))
	if opts := getMessageOptions(message); opts != nil && opts.Table != nil {
		tableName = opts.GetTable()
	}
	p.P(`return "`, tableName, `"`)
	p.P(`}`)
}
func ( p * OrmPlugin ) generateTableNameFunction ( message pgs . Message ) { typeName := p . TypeName ( message ) p . P ( `// TableName overrides the default tablename generated by GORM` ) p . P ( `func (` , typeName , `ORM) TableName() string {` ) tableName := inflection . Plural ( jgorm . ToDBName ( string ( message . Name ( ) ) ) ) if opts := getMessageOptions ( message ) ; opts != nil && opts . Table != nil { tableName = opts . GetTable ( ) } p . P ( `return "` , tableName , `"` ) p . P ( `}` ) }
generateTableNameFunction the function to set the gorm table name
back to gorm default, removing "ORM" suffix
generateTableNameFunction the function to set the gorm table name back to gorm default removing " ORM " suffix