Skip to content

Commit

Permalink
make groupablePlaceholder non exportable
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zhengda committed Oct 17, 2023
1 parent 1b11a0e commit 5bf54fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type StatementMetadata struct {
Commands []string
}

type GroupablePlaceholder struct {
type groupablePlaceholder struct {
groupable bool
}

Expand Down Expand Up @@ -98,7 +98,7 @@ func (n *Normalizer) Normalize(input string, lexerOpts ...lexerOption) (normaliz
}

var lastToken Token // The last token that is not whitespace or comment
var groupablePlaceholder GroupablePlaceholder
var groupablePlaceholder groupablePlaceholder

for _, token := range lexer.ScanAll() {
n.collectMetadata(&token, &lastToken, statementMetadata)
Expand Down Expand Up @@ -128,7 +128,7 @@ func (n *Normalizer) collectMetadata(token *Token, lastToken *Token, statementMe
}
}

func (n *Normalizer) normalizeSQL(token *Token, lastToken *Token, normalizedSQLBuilder *strings.Builder, groupablePlaceholder *GroupablePlaceholder) {
func (n *Normalizer) normalizeSQL(token *Token, lastToken *Token, normalizedSQLBuilder *strings.Builder, groupablePlaceholder *groupablePlaceholder) {
if token.Type != WS && token.Type != COMMENT && token.Type != MULTILINE_COMMENT {
if !n.config.KeepSQLAlias {
// discard SQL alias
Expand Down Expand Up @@ -179,7 +179,7 @@ func (n *Normalizer) writeToken(token *Token, normalizedSQLBuilder *strings.Buil
}
}

func (n *Normalizer) isObfuscatedValueGroupable(token *Token, lastToken *Token, groupablePlaceholder *GroupablePlaceholder) bool {
func (n *Normalizer) isObfuscatedValueGroupable(token *Token, lastToken *Token, groupablePlaceholder *groupablePlaceholder) bool {
if token.Value == NumberPlaceholder || token.Value == StringPlaceholder {
if lastToken.Value == "(" || lastToken.Value == "[" {
// if the last token is "(" or "[", and the current token is a placeholder,
Expand Down
2 changes: 1 addition & 1 deletion obfuscate_and_normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func ObfuscateAndNormalize(input string, obfuscator *Obfuscator, normalizer *Nor
}

var lastToken Token // The last token that is not whitespace or comment
var groupablePlaceholder GroupablePlaceholder
var groupablePlaceholder groupablePlaceholder

for _, token := range lexer.ScanAll() {
token.Value = obfuscator.ObfuscateTokenValue(token, lexerOpts...)
Expand Down

0 comments on commit 5bf54fb

Please sign in to comment.