func (b Base64) Value() (driver.Value, error) {
	return driver.Value(string(b)), nil
}
Value converts a value to a database driver value
package strfmt
import (
	"database/sql/driver"
	"encoding/base64"
	"errors"
	"fmt"
	"regexp"
	"strings"
	"github.com/asaskevich/govalidator"
	"github.com/mailru/easyjson/jlexer"
	"github.com/mailru/easyjson/jwriter"
	"gopkg.in/mgo.v2/bson"
)
const (
	HostnamePattern = `^[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?(\.[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?)*$`
	UUIDPattern = `(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`
	UUID3Pattern = `(?i)^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$`
	UUID4Pattern = `(?i)^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`
	UUID5Pattern = `(?i)^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`
)
var (
	rxHostname = regexp.MustCompile(HostnamePattern)
	rxUUID     = regexp.MustCompile(UUIDPattern)
	rxUUID3    = regexp.MustCompile(UUID3Pattern)
	rxUUID4    = regexp.MustCompile(UUID4Pattern)
	rxUUID5    = regexp.MustCompile(UUID5Pattern)
)
func IsHostname(str string) bool {
	if !rxHostname.MatchString(str) {
		return false
	}
	if len(str) > 255 {
		return false
	}
	parts := strings.Split(str, ".")
	valid := true
	for _, p := range parts {
		if len(p) > 63 {
			valid = false
		}
	}
	return valid
}
func IsUUID(str string) bool {
	return rxUUID.MatchString(str)
}
func IsUUID3(str string) bool {
	return rxUUID3.MatchString(str)
}
func IsUUID4(str string) bool {
	return rxUUID4.MatchString(str)
}
func IsUUID5(str string) bool {
	return rxUUID5.MatchString(str)
}
func init() {
	u := URI("")
	Default.Add("uri", &u, govalidator.IsRequestURI)
	eml := Email("")
	Default.Add("email", &eml, govalidator.IsEmail)
	hn := Hostname("")
	Default.Add("hostname", &hn, IsHostname)
	ip4 := IPv4("")
	Default.Add("ipv4", &ip4, govalidator.IsIPv4)
	ip6 := IPv6("")
	Default.Add("ipv6", &ip6, govalidator.IsIPv6)
	mac := MAC("")
	Default.Add("mac", &mac, govalidator.IsMAC)
	uid := UUID("")
	Default.Add("uuid", &uid, IsUUID)
	uid3 := UUID3("")
	Default.Add("uuid3", &uid3, IsUUID3)
	uid4 := UUID4("")
	Default.Add("uuid4", &uid4, IsUUID4)
	uid5 := UUID5("")
	Default.Add("uuid5", &uid5, IsUUID5)
	isbn := ISBN("")
	Default.Add("isbn", &isbn, func(str string) bool { return govalidator.IsISBN10(str) || govalidator.IsISBN13(str) })
	isbn10 := ISBN10("")
	Default.Add("isbn10", &isbn10, govalidator.IsISBN10)
	isbn13 := ISBN13("")
	Default.Add("isbn13", &isbn13, govalidator.IsISBN13)
	cc := CreditCard("")
	Default.Add("creditcard", &cc, govalidator.IsCreditCard)
	ssn := SSN("")
	Default.Add("ssn", &ssn, govalidator.IsSSN)
	hc := HexColor("")
	Default.Add("hexcolor", &hc, govalidator.IsHexcolor)
	rc := RGBColor("")
	Default.Add("rgbcolor", &rc, govalidator.IsRGBcolor)
	b64 := Base64([]byte(nil))
	Default.Add("byte", &b64, govalidator.IsBase64)
	pw := Password("")
	Default.Add("password", &pw, func(_ string) bool { return true })
}
var formatCheckers = map[string]Validator{
	"byte": govalidator.IsBase64,
}
type Base64 []byte
func (b Base64) MarshalText() ([]byte, error) {
	enc := base64.URLEncoding
	src := []byte(b)
	buf := make([]byte, enc.EncodedLen(len(src)))
	enc.Encode(buf, src)
	return buf, nil
}
func (b *Base64) UnmarshalText(data []byte) error {  
	enc := base64.URLEncoding
	dbuf := make([]byte, enc.DecodedLen(len(data)))
	n, err := enc.Decode(dbuf, data)
	if err != nil {
		return err
	}
	*b = dbuf[:n]
	return nil
}
func (b *Base64) Scan(raw interface{}) error {
	switch v := raw.(type) {
	case []byte:
		*b = Base64(string(v))
	case string:
		*b = Base64(v)
	default:
		return fmt.Errorf("cannot sql.Scan() strfmt.Base64 from: %#v", v)
	}
	return nil
}