driver/converter.go
func convertNvString(v interface{}) (driver.Value, error) {

	if v == nil {
		return v, nil
	}

	switch v := v.(type) {

	case string, []byte:
		return v, nil
	}

	rv := reflect.ValueOf(v)

	switch rv.Kind() {

	case reflect.String:
		return rv.String(), nil

	case reflect.Slice:
		if rv.Type() == typeOfBytes {
			return rv.Bytes(), nil
		}

	case reflect.Ptr:
		// indirect pointers
		if rv.IsNil() {
			return nil, nil
		}
		return convertNvString(rv.Elem().Interface())
	}

	if rv.Type().ConvertibleTo(typeOfBytes) {
		bv := rv.Convert(typeOfBytes)
		return bv.Interface().([]byte), nil
	}

	return nil, fmt.Errorf("unsupported character conversion type error %[1]T %[1]v", v)
}
func convertNvString(v interface{}) (driver.Value, error) {

	if v == nil {
		return v, nil
	}

	switch v := v.(type) {

	case string, []byte:
		return v, nil
	}

	rv := reflect.ValueOf(v)

	switch rv.Kind() {

	case reflect.String:
		return rv.String(), nil

	case reflect.Slice:
		if rv.Type() == typeOfBytes {
			return rv.Bytes(), nil
		}

	case reflect.Ptr:
		// indirect pointers
		if rv.IsNil() {
			return nil, nil
		}
		return convertNvString(rv.Elem().Interface())
	}

	if rv.Type().ConvertibleTo(typeOfBytes) {
		bv := rv.Convert(typeOfBytes)
		return bv.Interface().([]byte), nil
	}

	return nil, fmt.Errorf("unsupported character conversion type error %[1]T %[1]v", v)
}
func convertNvString ( v interface { } ) ( driver . Value , error ) { if v == nil { return v , nil } switch v := v . ( type ) { case string , [ ] byte : return v , nil } rv := reflect . ValueOf ( v ) switch rv . Kind ( ) { case reflect . String : return rv . String ( ) , nil case reflect . Slice : if rv . Type ( ) == typeOfBytes { return rv . Bytes ( ) , nil } case reflect . Ptr : // indirect pointers if rv . IsNil ( ) { return nil , nil } return convertNvString ( rv . Elem ( ) . Interface ( ) ) } if rv . Type ( ) . ConvertibleTo ( typeOfBytes ) { bv := rv . Convert ( typeOfBytes ) return bv . Interface ( ) . ( [ ] byte ) , nil } return nil , fmt . Errorf ( " " , v ) }
// string
string