func (c *Column) Equals(c2 *Column) bool {
	return c.Name == c2.Name &&
		c.Source == c2.Source &&
		c.Nullable == c2.Nullable &&
		reflect.DeepEqual(c.Default, c2.Default) &&
		reflect.DeepEqual(c.Type, c2.Type)
}
Equals checks whether two columns are equal.
package sql
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"math"
	"reflect"
	"strconv"
	"strings"
	"time"
	"github.com/spf13/cast"
	"gopkg.in/src-d/go-errors.v1"
	"vitess.io/vitess/go/sqltypes"
	"vitess.io/vitess/go/vt/proto/query"
)
var (
	ErrTypeNotSupported = errors.NewKind("Type not supported: %s")
	ErrUnexpectedType = errors.NewKind("value at %d has unexpected type: %s")
	ErrConvertingToTime = errors.NewKind("value %q can't be converted to time.Time")
	ErrCharTruncation = errors.NewKind("string value of %q is longer than destination capacity %d")
	ErrVarCharTruncation = errors.NewKind("string value of %q is longer than destination capacity %d")
	ErrValueNotNil = errors.NewKind("value not nil: %#v")
	ErrNotTuple = errors.NewKind("value of type %T is not a tuple")
	ErrInvalidColumnNumber = errors.NewKind("tuple should contain %d column(s), but has %d")
	ErrNotArray = errors.NewKind("value of type %T is not an array")
	ErrConvertToSQL = errors.NewKind("incompatible conversion to SQL type: %s")
)
type Schema []*Column
func (s Schema) CheckRow(row Row) error {
	expected := len(s)
	got := len(row)
	if expected != got {
		return ErrUnexpectedRowLength.New(expected, got)
	}
	for idx, f := range s {
		v := row[idx]
		if f.Check(v) {
			continue
		}
		typ := reflect.TypeOf(v).String()
		return ErrUnexpectedType.New(idx, typ)
	}
	return nil
}
func (s Schema) Contains(column string, source string) bool {
	return s.IndexOf(column, source) >= 0
}
func (s Schema) IndexOf(column, source string) int {
	column = strings.ToLower(column)
	source = strings.ToLower(source)
	for i, col := range s {
		if strings.ToLower(col.Name) == column && strings.ToLower(col.Source) == source {
			return i
		}
	}
	return -1
}
func (s Schema) Equals(s2 Schema) bool {
	if len(s) != len(s2) {
		return false
	}
	for i := range s {
		if !s[i].Equals(s2[i]) {
			return false
		}
	}
	return true
}
type Column struct {
	Name string
	Type Type
	Default interface{}
	Nullable bool
	Source string
	PrimaryKey bool
}
func (c *Column) Check(v interface{}) bool {
	if v == nil {
		return c.Nullable
	}
	_, err := c.Type.Convert(v)
	return err == nil
}