add null db for --dry-run

master
Oliver Tonnhofer 2013-05-21 12:14:05 +02:00
parent 0473597fa6
commit c66d075d3b
2 changed files with 21 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package database
import (
"goposm/mapping"
"strings"
)
type Config struct {
@ -36,3 +37,21 @@ func Open(conf Config) (DB, error) {
}
return db, nil
}
func ConnectionType(param string) string {
parts := strings.SplitN(param, ":", 2)
return parts[0]
}
type NullDb struct{}
func (n *NullDb) Init(*mapping.Mapping) error { return nil }
func (n *NullDb) InsertBatch(string, [][]interface{}) error { return nil }
func NewNullDb(conf Config) (DB, error) {
return &NullDb{}, nil
}
func init() {
Register("null", NewNullDb)
}

View File

@ -119,8 +119,9 @@ func main() {
log.Fatal(err)
}
connType := database.ConnectionType(*connection)
conf := database.Config{
Type: "postgis",
Type: connType,
ConnectionParams: *connection,
Srid: 3857,
}
@ -165,5 +166,4 @@ func main() {
}
progress.Stop()
//parser.PBFStats(os.Args[1])
}