MCPcopy Create free account
hub / github.com/bytebase/bytebase / triggersEqual

Function triggersEqual

backend/plugin/schema/differ.go:1422–1445  ·  view source on GitHub ↗

triggersEqual checks if two triggers are equal.

(t1, t2 *storepb.TriggerMetadata)

Source from the content-addressed store, hash-verified

1420
1421// triggersEqual checks if two triggers are equal.
1422func triggersEqual(t1, t2 *storepb.TriggerMetadata) bool {
1423 if t1 == nil || t2 == nil {
1424 return t1 == t2
1425 }
1426
1427 basicEqual := t1.Name == t2.Name &&
1428 t1.Event == t2.Event &&
1429 t1.Timing == t2.Timing
1430
1431 if !basicEqual {
1432 return false
1433 }
1434
1435 // Direct comparison first
1436 if t1.Body == t2.Body {
1437 return true
1438 }
1439
1440 // Normalize both bodies for comparison
1441 norm1 := normalizeTriggerBody(t1.Body)
1442 norm2 := normalizeTriggerBody(t2.Body)
1443
1444 return norm1 == norm2
1445}
1446
1447// normalizeTriggerBody normalizes trigger body for comparison
1448func normalizeTriggerBody(body string) string {

Callers 1

compareTriggersFunction · 0.85

Calls 1

normalizeTriggerBodyFunction · 0.85

Tested by

no test coverage detected