MCPcopy Create free account
hub / github.com/araddon/qlbridge / parseFieldList

Method parseFieldList

rel/parse_sql.go:1004–1037  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1002}
1003
1004func (m *Sqlbridge) parseFieldList() (Columns, error) {
1005
1006 if m.Cur().T != lex.TokenLeftParenthesis {
1007 return nil, m.ErrMsg("Expecting opening paren")
1008 }
1009 m.Next()
1010
1011 cols := make(Columns, 0)
1012 var col *Column
1013
1014 for {
1015
1016 //u.Debug(m.Cur().String())
1017 switch m.Cur().T {
1018 case lex.TokenIdentity:
1019 col = NewColumnFromToken(m.Cur())
1020 m.Next()
1021 }
1022 //u.Debugf("after colstart?: %v ", m.Cur())
1023
1024 // since we can loop inside switch statement
1025 switch m.Cur().T {
1026 case lex.TokenFrom, lex.TokenInto, lex.TokenLimit, lex.TokenEOS, lex.TokenEOF,
1027 lex.TokenRightParenthesis:
1028 cols = append(cols, col)
1029 return cols, nil
1030 case lex.TokenComma:
1031 cols = append(cols, col)
1032 default:
1033 return nil, m.ErrMsg("expected column but")
1034 }
1035 m.Next()
1036 }
1037}
1038
1039func (m *Sqlbridge) parseUpdateList() (map[string]*ValueColumn, error) {
1040

Callers 2

parseSqlInsertMethod · 0.95
parseSqlUpsertMethod · 0.95

Calls 4

NewColumnFromTokenFunction · 0.85
CurMethod · 0.65
ErrMsgMethod · 0.65
NextMethod · 0.65

Tested by

no test coverage detected