Skip to content

Commit

Permalink
column: export GetTypeDesc
Browse files Browse the repository at this point in the history
  • Loading branch information
siddontang committed Sep 28, 2015
1 parent 33998d6 commit b28a929
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions column/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ type ColDesc struct {

const defaultPrivileges string = "select,insert,update,references"

func (c *Col) getTypeDesc() string {
// GetTypeDesc gets the description for column type.
func (c *Col) GetTypeDesc() string {
ans := []string{types.FieldTypeToStr(c.Tp, c.Charset)}
switch c.Tp {
case mysql.TypeSet, mysql.TypeEnum:
Expand Down Expand Up @@ -207,7 +208,7 @@ func NewColDesc(col *Col) *ColDesc {

return &ColDesc{
Field: name.O,
Type: col.getTypeDesc(),
Type: col.GetTypeDesc(),
Collation: col.Collate,
Null: nullFlag,
Key: keyFlag,
Expand Down
3 changes: 2 additions & 1 deletion column/column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package column

import (
"strings"
"testing"

. "github.com/pingcap/check"
Expand Down Expand Up @@ -50,7 +51,7 @@ func (s *testColumnSuite) TestString(c *C) {
col.Tp = mysql.TypeEnum
col.Flag = 0
col.Elems = []string{"a", "b"}
c.Assert(col.getTypeDesc(), Equals, "ENUM ('a','b')")
c.Assert(strings.ToLower(col.GetTypeDesc()), Equals, "enum ('a','b')")
}

func (s *testColumnSuite) TestFind(c *C) {
Expand Down

0 comments on commit b28a929

Please sign in to comment.