func (x ImageType) Value() (driver.Value, error) {
	return int64(x), nil
}
Value implements the driver Valuer interface.
package example
import (
	"database/sql/driver"
	"errors"
	"fmt"
	"strconv"
)
const (
	ImageTypeJpeg ImageType = iota
	ImageTypeJpg
	ImageTypePng
	ImageTypeTiff
	ImageTypeGif
)
const _ImageTypeName = "jpegjpgpngtiffgif"
var _ImageTypeMap = map[ImageType]string{
	0: _ImageTypeName[0:4],
	1: _ImageTypeName[4:7],
	2: _ImageTypeName[7:10],
	3: _ImageTypeName[10:14],
	4: _ImageTypeName[14:17],
}
func (x ImageType) String() string {
	if str, ok := _ImageTypeMap[x]; ok {
		return str
	}
	return fmt.Sprintf("ImageType(%d)", x)
}
var _ImageTypeValue = map[string]ImageType{
	_ImageTypeName[0:4]:   0,
	_ImageTypeName[4:7]:   1,
	_ImageTypeName[7:10]:  2,
	_ImageTypeName[10:14]: 3,
	_ImageTypeName[14:17]: 4,
}
func ParseImageType(name string) (ImageType, error) {
	if x, ok := _ImageTypeValue[name]; ok {
		return x, nil
	}
	return ImageType(0), fmt.Errorf("%s is not a valid ImageType", name)
}
var _ImageTypeErrNilPtr = errors.New("value pointer is nil")  
func (x *ImageType) Scan(value interface{}) (err error) {
	if value == nil {
		*x = ImageType(0)
		return
	}
	switch v := value.(type) {
	case int64:
		*x = ImageType(v)
	case string:
		*x, err = ParseImageType(v)
		if err != nil {
			if val, verr := strconv.Atoi(v); verr == nil {
				*x, err = ImageType(val), nil
			}
		}
	case []byte:
		*x, err = ParseImageType(string(v))
		if err != nil {
			if val, verr := strconv.Atoi(string(v)); verr == nil {
				*x, err = ImageType(val), nil
			}
		}
	case ImageType:
		*x = v
	case int:
		*x = ImageType(v)
	case *ImageType:
		if v == nil {
			return _ImageTypeErrNilPtr
		}
		*x = *v
	case uint:
		*x = ImageType(v)
	case uint64:
		*x = ImageType(v)
	case *int:
		if v == nil {
			return _ImageTypeErrNilPtr
		}
		*x = ImageType(*v)
	case *int64:
		if v == nil {
			return _ImageTypeErrNilPtr
		}
		*x = ImageType(*v)
	case float64:  
		*x = ImageType(v)
	case *float64:  
		if v == nil {
			return _ImageTypeErrNilPtr
		}
		*x = ImageType(*v)
	case *uint:
		if v == nil {
			return _ImageTypeErrNilPtr
		}
		*x = ImageType(*v)
	case *uint64:
		if v == nil {
			return _ImageTypeErrNilPtr
		}
		*x = ImageType(*v)
	case *string:
		if v == nil {
			return _ImageTypeErrNilPtr
		}
		*x, err = ParseImageType(*v)
		if err != nil {
			if val, verr := strconv.Atoi(*v); verr == nil {
				*x, err = ImageType(val), nil
			}
		}
	}
	return
}