func NewColDesc(tbl Table, col *Column) *ColDesc {
	name := col.ColumnMeta.ColumnMeta.Name
	idxName := "null"
	_, idxMeta := tbl.Meta().GetIndexByColumnName(name)
	if idxMeta != nil {
		idxName = idxMeta.Name
	}
	if col.IsPrimary {
		idxName = "primary"
	}
	desc := &ColDesc{
		Field: name,
		Type:  col.GetTypeDesc(),
		Key:   idxName,
	}
	return desc
}
NewColDesc returns a new ColDesc for a column.
package table
import (
	"strings"
	"github.com/pingcap/parser/mysql"
	"github.com/pingcap/tidb/types"
	"github.com/pingcap/tidb/util/hack"
	"github.com/zhihu/zetta/pkg/model"
)
type Column struct {
	*model.ColumnMeta
}
func (c *Column) String() string {
	return ""
}
func FindCol(cols []*model.ColumnMeta, name string) *model.ColumnMeta {
	for _, col := range cols {
		if strings.EqualFold(col.ColumnMeta.Name, name) {
			return col
		}
	}
	return nil
}
func ToColumn(col *model.ColumnMeta) *Column {
	return &Column{
		col,
	}
}
func truncateTrailingSpaces(v *types.Datum) {
	if v.Kind() == types.KindNull {
		return
	}
	b := v.GetBytes()
	length := len(b)
	for length > 0 && b[length-1] == ' ' {
		length--
	}
	b = b[:length]
	str := string(hack.String(b))
	v.SetString(str, v.Collation())
}
type ColDesc struct {
	Field string
	Type  string
	Key   string
}
const defaultPrivileges = "select,insert,update,references"