From 4f1b611b695ba6e0960763a9bc084430fd7ca9a6 Mon Sep 17 00:00:00 2001 From: Zhengda Lu Date: Fri, 22 Sep 2023 11:17:40 -0400 Subject: [PATCH] rename to bind parameter --- sqllexer.go | 10 +++++----- sqllexer_test.go | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sqllexer.go b/sqllexer.go index 30203d1..7ba1b04 100644 --- a/sqllexer.go +++ b/sqllexer.go @@ -18,7 +18,7 @@ const ( DOLLAR_QUOTED_FUNCTION // dollar quoted function DOLLAR_QUOTED_STRING // dollar quoted string POSITIONAL_PARAMETER // numbered parameter - BINDED_PARAMETER // binded parameter + BIND_PARAMETER // bind parameter UNKNOWN // unknown token ) @@ -130,12 +130,12 @@ func (s *Lexer) Scan() Token { return s.scanDollarQuotedString() case ch == ':': if s.config.DBMS == DBMSOracle && isLetter(s.lookAhead(1)) { - return s.scanBindedParameter() + return s.scanBindParameter() } return s.scanOperator() case ch == '@': if s.config.DBMS == DBMSSQLServer && isLetter(s.lookAhead(1)) { - return s.scanBindedParameter() + return s.scanBindParameter() } return s.scanOperator() case isOperator(ch): @@ -416,7 +416,7 @@ func (s *Lexer) scanPositionalParameter() Token { return Token{POSITIONAL_PARAMETER, s.src[s.start:s.cursor]} } -func (s *Lexer) scanBindedParameter() Token { +func (s *Lexer) scanBindParameter() Token { s.start = s.cursor ch := s.nextBy(2) // consume the (colon|at sign) and the char for { @@ -425,7 +425,7 @@ func (s *Lexer) scanBindedParameter() Token { } ch = s.next() } - return Token{BINDED_PARAMETER, s.src[s.start:s.cursor]} + return Token{BIND_PARAMETER, s.src[s.start:s.cursor]} } func (s *Lexer) scanUnknown() Token { diff --git a/sqllexer_test.go b/sqllexer_test.go index e5eb85e..443f0f3 100644 --- a/sqllexer_test.go +++ b/sqllexer_test.go @@ -471,7 +471,7 @@ func TestLexer(t *testing.T) { }, }, { - name: "select with binded parameter", + name: "select with bind parameter", input: "SELECT * FROM users where id = :id", expected: []Token{ {IDENT, "SELECT"}, @@ -488,12 +488,12 @@ func TestLexer(t *testing.T) { {WS, " "}, {OPERATOR, "="}, {WS, " "}, - {BINDED_PARAMETER, ":id"}, + {BIND_PARAMETER, ":id"}, }, lexerOpts: []lexerOption{WithDBMS(DBMSOracle)}, }, { - name: "select with binded parameter", + name: "select with bind parameter", input: "SELECT * FROM users where id = @id", expected: []Token{ {IDENT, "SELECT"}, @@ -510,7 +510,7 @@ func TestLexer(t *testing.T) { {WS, " "}, {OPERATOR, "="}, {WS, " "}, - {BINDED_PARAMETER, "@id"}, + {BIND_PARAMETER, "@id"}, }, lexerOpts: []lexerOption{WithDBMS(DBMSSQLServer)}, },