func hasValidPrefix(str string) bool {
	return strings.HasPrefix(str, "postgres://") || strings.HasPrefix(str, "postgresql://")
}
Check if connection url has a correct postgres prefix
package connection
import (
	"errors"
	"fmt"
	neturl "net/url"
	"os"
	"os/user"
	"strings"
	"github.com/sosedoff/pgweb/pkg/command"
)
var (
	errCantDetectUser   = errors.New("Could not detect default username")
	errInvalidURLFormat = errors.New("Invalid URL. Valid format: postgres://user:password@host:port/db?sslmode=mode")
)
func currentUser() (string, error) {
	u, err := user.Current()
	if err == nil {
		return u.Username, nil
	}
	name := os.Getenv("USER")
	if name != "" {
		return name, nil
	}
	return "", errCantDetectUser
}