You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: genmssql.go
    path of file: ./repos/gormt/data/view/model/genmssql
    
    the code of the file until where you have to start completion: package genmssql

import (
	"fmt"
	"sort"
	"strings"

	"github.com/xxjwxc/gormt/data/config"
	"github.com/xxjwxc/gormt/data/view/model"
	"gith
    
func (m *mssqlModel) getTableElement(orm *gorm.DB, tab string) (el []model.ColumnsInfo) {
	sql := fmt.Sprintf(`SELECT 
    id   = a.colorder,
    name     = a.name,
    pk       = case when exists(SELECT 1 FROM sysobjects where xtype='PK' and parent_obj=a.id and name in (
                     SELECT name FROM sysindexes WHERE indid in( SELECT indid FROM sysindexkeys WHERE id = a.id AND colid=a.colid))) then 1 else 0 end,
    tp       = b.name,
    len       = COLUMNPROPERTY(a.id,a.name,'PRECISION'),
    isnull     = a.isnullable,
    des   = isnull(g.[value],'')
FROM 
    syscolumns a
left join 
    systypes b 
on 
    a.xusertype=b.xusertype
inner join 
    sysobjects d 
on 
    a.id=d.id  and d.xtype='U' and  d.name<>'dtproperties'
left join 
sys.extended_properties   g 
on 
    a.id=G.major_id and a.colid=g.minor_id  
left join
sys.extended_properties f
on 
    d.id=f.major_id and f.minor_id=0
where 
    d.name='%v' 
order by 
    a.colorder`, tab)

	lenPk := 0
	// get keys
	var Keys []ColumnKeys
	orm.Raw(sql).Scan(&Keys)
	for i := 0; i < len(Keys); i++ {
		v := &Keys[i]
		if v.Pk == 1 {
			lenPk++
		}
		if strings.EqualFold(v.Type, "varchar") { // 字符串
			v.Type = fmt.Sprintf("varchar(%v)", v.Length)
		} else if strings.EqualFold(v.Type, "int") { // int
			v.Type = fmt.Sprintf("int(%v)", v.Length)
		}
	}
	// ----------end

	// TODO:ForeignKey

	for _, v := range Keys {
		var tmp model.ColumnsInfo
		tmp.Name = v.Name
		tmp.Type = v.Type
		FixNotes(&tmp, v.Desc) // 分析表注释

		if v.Pk > 0 { // 主键，或者联合组件
			if lenPk <= 1 { // 主键
				tmp.Index = append(tmp.Index, model.KList{
					Key:     model.ColumnsKeyPrimary,
					Multi:   false,
					KeyType: "primaryKey",
				})
			} else {
				tmp.Index = append(tmp.Index, model.KList{
					Key:     model.ColumnsKeyPrimary,
					Multi:   true,
					KeyType: "FULLTEXT",
				})
			}
		}

		tmp.IsNull = (v.Isnull == 1)

		el = append(el, tmp)
	}
	return
}