MCPcopy Index your code
hub / github.com/LissaGreense/GO4SQL / parseDeleteCommand

Method parseDeleteCommand

parser/parser.go:384–409  ·  view source on GitHub ↗

parseDeleteCommand - Return ast.DeleteCommand created from tokens and validate the syntax Example of input parsable to the ast.DeleteCommand: DELETE FROM table;

()

Source from the content-addressed store, hash-verified

382// Example of input parsable to the ast.DeleteCommand:
383// DELETE FROM table;
384func (parser *Parser) parseDeleteCommand() (ast.Command, error) {
385 // token.DELETE already at current position in parser
386 deleteCommand := &ast.DeleteCommand{Token: parser.currentToken}
387
388 // token.DELETE no longer needed
389 parser.nextToken()
390
391 err := validateTokenAndSkip(parser, []token.Type{token.FROM})
392 if err != nil {
393 return nil, err
394 }
395
396 err = validateToken(parser.currentToken.Type, []token.Type{token.IDENT})
397 if err != nil {
398 return nil, err
399 }
400 deleteCommand.Name = ast.Identifier{Token: parser.currentToken}
401
402 // token.IDENT no longer needed
403 parser.nextToken()
404
405 // expect WHERE
406 err = validateToken(parser.currentToken.Type, []token.Type{token.WHERE})
407
408 return deleteCommand, err
409}
410
411// parseDropCommand - Return ast.DropCommand created from tokens and validate the syntax
412//

Callers 1

ParseSequenceMethod · 0.95

Calls 3

nextTokenMethod · 0.95
validateTokenAndSkipFunction · 0.85
validateTokenFunction · 0.85

Tested by

no test coverage detected