add null db for --dry-run
parent
0473597fa6
commit
c66d075d3b
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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])
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue