WIP: add tile updating in in web mapper with pg listen/notify

This commit is contained in:
Sascha L. Teichmann
2022-02-28 11:07:50 +01:00
parent 4b654672e7
commit d98df1c1cd
5 changed files with 102 additions and 21 deletions

View File

@ -11,10 +11,16 @@ import (
type DBClientCreator func() (DBClient, error)
func IsPostgreSQL(host string) (string, bool) {
if strings.HasPrefix(host, "postgres:") {
return host[len("postgres:"):], true
}
return "", false
}
func CreateDBClientCreator(host string, port int) DBClientCreator {
if strings.HasPrefix(host, "postgres:") {
host = host[len("postgres:"):]
if host, ok := IsPostgreSQL(host); ok {
return func() (DBClient, error) {
return NewPGClient(host)
}