Skip to content

Commit

Permalink
implement allocation free fast path for isBoolean and isNull (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcacheux authored Nov 12, 2024
1 parent 8c03f53 commit 96160b1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sqllexer_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,20 @@ func isProcedure(token *Token) bool {
}

func isBoolean(ident string) bool {
// allocation free fast path for common cases
if ident == "true" || ident == "false" || ident == "TRUE" || ident == "FALSE" {
return true
}

return strings.ToUpper(ident) == "TRUE" || strings.ToUpper(ident) == "FALSE"
}

func isNull(ident string) bool {
// allocation free fast path for common cases
if ident == "null" || ident == "NULL" {
return true
}

return strings.ToUpper(ident) == "NULL"
}

Expand Down

0 comments on commit 96160b1

Please sign in to comment.