-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refine the replica-setup-pg and its doc
- Loading branch information
1 parent
81cb2ab
commit c1a31a9
Showing
7 changed files
with
36 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package pgserver | ||
|
||
import "regexp" | ||
|
||
type QueryModifier func(string) string | ||
|
||
func NewQueryReplacer(regex string, replacement string) QueryModifier { | ||
r := regexp.MustCompile(regex) | ||
return func(query string) string { | ||
return r.ReplaceAllString(query, replacement) | ||
} | ||
|
||
} | ||
|
||
func NewQueryRemover(regex string) QueryModifier { | ||
return NewQueryReplacer(regex, "") | ||
} | ||
|
||
var ( | ||
removeLocaleProvider = NewQueryRemover(`(?i)LOCALE_PROVIDER = [^ ;]*`) | ||
removeLocale = NewQueryRemover(`(?i)LOCALE = [^ ;]*`) | ||
) |