func New() *Host {
	connectionString := defaultDatabaseServer + defaultDatabaseName
	if !strings.HasSuffix(defaultDatabaseServer, "/") {
		connectionString = defaultDatabaseServer + "/" + defaultDatabaseName
	}
	return NewHost(connectionString)
}
New sets up a connection to the default (local) database host
package simplehstore
import (
	"database/sql"
	"errors"
	"fmt"
	"log"
	"strconv"
	"strings"
	pq "github.com/lib/pq"
	"github.com/xyproto/env"
)
const (
	Version = 2.10
	defaultStringType = "TEXT"
	defaultPort       = 5432
	encoding          = "UTF8"
)
type Host struct {
	db     *sql.DB
	dbname string
	rawUTF8 bool
}
type dbDatastructure struct {
	host  *Host
	table string
}
type (
	List dbDatastructure
	Set dbDatastructure
	HashMap dbDatastructure
	KeyValue dbDatastructure
)
var (
	defaultDatabaseServer = env.Str("POSTGRES_USER", "postgres") + "@" + env.Str("POSTGRES_PASSWORD") + "@127.0.0.1/"
	defaultDatabaseName   = env.Str("POSTGRES_DB", "test")
	ErrNoAvailableValues = errors.New("no available values")
	ErrTooFewResults = errors.New("too few results")
	listCol  = "a_list"
	setCol   = "a_set"
	ownerCol = "owner"
	kvPrefix = "a_kv_"
)
func SetColumnNames(list, set, hashMapOwner, keyValuePrefix string) {
	listCol = list
	setCol = set
	ownerCol = hashMapOwner
	kvPrefix = keyValuePrefix
}
func TestConnection() (err error) {
	return TestConnectionHost(defaultDatabaseServer)
}
func TestConnectionHost(connectionString string) error {
	newConnectionString, _ := rebuildConnectionString(connectionString, false)
	db, err := sql.Open("postgres", newConnectionString)
	if err != nil {
		return err
	}
	defer db.Close()
	err = db.Ping()
	if Verbose {
		if err != nil {
			log.Println("Ping: failed")
		} else {
			log.Println("Ping: ok")
		}
	}
	return err
}
func TestConnectionHostWithDSN(connectionString string) error {
	db, err := sql.Open("postgres", connectionString)
	if err != nil {
		return err
	}
	defer db.Close()
	err = db.Ping()
	if Verbose {
		if err != nil {
			log.Println("Ping: failed")
		} else {
			log.Println("Ping: ok")
		}
	}
	return err
}
func singleQuote(s string) string {
	return "'" + escape(s) + "'"
}
func escape(s string) string {
	return strings.Replace(s, "'", "''", -1)
}
func NewHost(connectionString string) *Host {
	host, err := NewHost2(connectionString)
	if err != nil {
		log.Fatalln(err)
	}
	return host
}
func NewHost2(connectionString string) (*Host, error) {
	newConnectionString, dbname := rebuildConnectionString(connectionString, true)
	db, err := sql.Open("postgres", newConnectionString)
	if err != nil {
		return nil, fmt.Errorf("could not connect to %s", newConnectionString)
	}
	host := &Host{db, pq.QuoteIdentifier(dbname), false}
	if err := host.Ping(); err != nil {
		return nil, fmt.Errorf("database host does not reply to ping: %s", err)
	}
	if err := host.createDatabase(); err != nil {
		return nil, fmt.Errorf("could not create database %s: %s", host.dbname, err)
	}
	if err := host.useDatabase(); err != nil {
		return nil, fmt.Errorf("could not use database %s: %s", host.dbname, err)
	}
	return host, nil
}
func NewHostWithDSN(connectionString string, dbname string) *Host {
	host, err := NewHostWithDSN2(connectionString, dbname)
	if err != nil {
		log.Fatalln(err)
	}
	return host
}
func NewHostWithDSN2(connectionString string, dbname string) (*Host, error) {
	db, err := sql.Open("postgres", connectionString)
	if err != nil {
		return nil, fmt.Errorf("could not connect to %s", connectionString)
	}
	host := &Host{db, pq.QuoteIdentifier(dbname), false}
	if err := host.Ping(); err != nil {
		return nil, fmt.Errorf("database host does not reply to ping: %s", err)
	}
	if err := host.createDatabase(); err != nil {
		return nil, fmt.Errorf("could not create database %s: %s", host.dbname, err)
	}
	if err := host.useDatabase(); err != nil {
		return nil, fmt.Errorf("could not use database %s: %s", host.dbname, err)
	}
	return host, nil
}