MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / parseReferentialActions

Method parseReferentialActions

pkg/sql/parser/ddl_columns.go:293–308  ·  view source on GitHub ↗

parseReferentialActions parses ON DELETE and ON UPDATE actions

()

Source from the content-addressed store, hash-verified

291
292// parseReferentialActions parses ON DELETE and ON UPDATE actions
293func (p *Parser) parseReferentialActions() (onDelete, onUpdate string) {
294 for p.isType(models.TokenTypeOn) {
295 p.advance() // Consume ON
296
297 if p.isType(models.TokenTypeDelete) {
298 p.advance() // Consume DELETE
299 onDelete = p.parseReferentialAction()
300 } else if p.isType(models.TokenTypeUpdate) {
301 p.advance() // Consume UPDATE
302 onUpdate = p.parseReferentialAction()
303 } else {
304 break
305 }
306 }
307 return
308}
309
310// parseReferentialAction parses a single referential action (CASCADE, SET NULL, etc.)
311func (p *Parser) parseReferentialAction() string {

Callers 2

parseColumnConstraintMethod · 0.95
parseTableConstraintMethod · 0.95

Calls 3

isTypeMethod · 0.95
advanceMethod · 0.95

Tested by

no test coverage detected