// Value implements the driver Valuer interface.
347431
func (i Int32) Value() (driver.Value, error) {
	if !i.Valid {
		return nil, nil
	}
	return int64(i.Int32), nil
}
1138653
func (s *Scanner) Value() []byte {
	if s.valid {
		return s.cache[s.idx].Value
	}
	return nil
}
1261006
func (o UUID) Value() (value driver.Value, err error) {
	if IsNil(o) {
		value, err = nil, nil
		return
	}
	value, err = o.MarshalText()
	return
}
616877
func (d *Decimal) Value() (driver.Value, error) {
	if d.V == nil {
		if d.Zero {
			return "0", nil
		}
		return nil, nil
	}
	v := d.V
	if v.IsNaN(0) {
		return "NaN", nil
	}
	if v.IsInf(0) {
		return nil, errors.New("Decimal.Value: DECIMAL does not accept Infinities")
	}

	dl := v.Precision()  // length of d
	sl := int(v.Scale()) // length of fractional part

	if il := dl - sl; il > MaxIntegralDigits {
		if !d.Round {
			return nil, &LengthError{Part: "integral", N: il, max: MaxIntegralDigits}
		}
		// Rounding down the integral part automatically chops off the fractional
		// part.
		return v.Round(MaxIntegralDigits).String(), nil
	}
	if sl > MaxFractionalDigits {
		if !d.Round {
			return nil, &LengthError{Part: "fractional", N: sl, max: MaxFractionalDigits}
		}
		v.Round(dl - (sl - MaxFractionalDigits))
	}
	return v.String(), nil
}
1187539
func (sa StringArray) Value() (driver.Value, error) {
	if !sa.Valid {
		return nil, nil
	}

	return StringArrayValue(sa.StringArray)
}
1325533
func (src *Bool) Value() (driver.Value, error) {
	switch src.Status {
	case Present:
		return src.Bool, nil
	case Null:
		return nil, nil
	default:
		return nil, errUndefined
	}
}
234782
func (t TimeDefLocal) Value() (driver.Value, error) {
	return t.T.Local(), nil
}
662721
func (src *TimestampArray) Value() (driver.Value, error) {
	buf, err := src.EncodeText(nil, nil)
	if err != nil {
		return nil, err
	}
	if buf == nil {
		return nil, nil
	}

	return string(buf), nil
}
104493
func (a UInt64Array) Value() (driver.Value, error) {
	if a == nil {
		return nil, nil
	}

	if n := len(a); n > 0 {
		// There will be at least two curly brackets, N bytes of values,
		// and N-1 bytes of delimiters.
		b := make([]byte, 1, 1+2*n)
		b[0] = '{'

		b = strconv.AppendUint(b, a[0], 10)
		for i := 1; i < n; i++ {
			b = append(b, ',')
			b = strconv.AppendUint(b, a[i], 10)
		}

		return string(append(b, '}')), nil
	}

	return "{}", nil
}
1290158
func (id ID) Value() (driver.Value, error) {
	if id.ID.IsNil() {
		return nil, nil
	}
	return id.ID[:], nil
}
1272380
func (src *pguint32) Value() (driver.Value, error) {
	switch src.Status {
	case Present:
		return int64(src.Uint), nil
	case Null:
		return nil, nil
	default:
		return nil, errUndefined
	}
}
443508
func (m Map) Value() (driver.Value, error) {
	b, err := json.Marshal(m)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	return string(b), nil
}
247528
func (i KSUID) Value() (driver.Value, error) {
	if i.IsNil() {
		return nil, nil
	}
	return i.String(), nil
}
570665
func (j JSON) Value() (driver.Value, error) {
	if len(j.RawMessage) == 0 {
		return nil, nil
	}
	return j.MarshalJSON()
}
609590
func (ns NullTime) Value() (driver.Value, error) {
	if (time.Time)(ns).IsZero() {
		return nil, nil
	}
	return (time.Time)(ns).Format("2006-01-02 15:04:05"), nil
}
1112078
func (n NullBool) Value() (driver.Value, error) {
	if !n.Valid {
		return nil, nil
	}
	return n.Bool, nil
}
1061910
func (i Image) Value() (driver.Value, error) {
	return driver.Value(i.String()), nil
}