func Rebind(bindType int, query string) string {
	switch bindType {
	case QUESTION, UNKNOWN:
		return query
	}
	qb := []byte(query)
	rqb := make([]byte, 0, len(qb)+10)
	j := 1
	for _, b := range qb {
		if b == '?' {
			switch bindType {
			case DOLLAR:
				rqb = append(rqb, '$')
			case NAMED:
				rqb = append(rqb, ':', 'a', 'r', 'g')
			}
			for _, b := range strconv.Itoa(j) {
				rqb = append(rqb, byte(b))
			}
			j++
		} else {
			rqb = append(rqb, b)
		}
	}
	return string(rqb)
}
FIXME: this should be able to be tolerant of escaped ?'s in queries without
losing much speed, and should be to avoid confusion.
Rebind a query from the default bindtype (QUESTION) to the target bindtype.
package sqlx
import (
	"bytes"
	"errors"
	"reflect"
	"strconv"
	"strings"
	"github.com/jmoiron/sqlx/reflectx"
)
const (
	UNKNOWN = iota
	QUESTION
	DOLLAR
	NAMED
)
func BindType(driverName string) int {
	switch driverName {
	case "postgres", "pgx":
		return DOLLAR
	case "mysql":
		return QUESTION
	case "sqlite3":
		return QUESTION
	case "oci8":
		return NAMED
	}
	return UNKNOWN
}