Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 29 | |
| 30 | // Format implements the NodeFormatter interface. |
| 31 | func (node *CreateTrigger) Format(ctx *FmtCtx) { |
| 32 | if node.Replace { |
| 33 | ctx.WriteString("CREATE OR REPLACE TRIGGER ") |
| 34 | } else { |
| 35 | ctx.WriteString("CREATE TRIGGER ") |
| 36 | } |
| 37 | node.Name.Format(ctx) |
| 38 | ctx.WriteString(" ") |
| 39 | node.ActionTime.Format(ctx) |
| 40 | ctx.WriteString(" ") |
| 41 | for i := range node.Events { |
| 42 | if i > 0 { |
| 43 | ctx.WriteString(" OR ") |
| 44 | } |
| 45 | node.Events[i].Format(ctx) |
| 46 | } |
| 47 | ctx.WriteString(" ON ") |
| 48 | ctx.FormatNode(node.TableName) |
| 49 | if len(node.Transitions) > 0 { |
| 50 | ctx.WriteString(" REFERENCING ") |
| 51 | for i := range node.Transitions { |
| 52 | if i > 0 { |
| 53 | ctx.WriteString(" ") |
| 54 | } |
| 55 | node.Transitions[i].Format(ctx) |
| 56 | } |
| 57 | } |
| 58 | ctx.WriteString(" ") |
| 59 | node.ForEach.Format(ctx) |
| 60 | if node.When != nil { |
| 61 | ctx.WriteString(" WHEN ") |
| 62 | ctx.FormatNode(node.When) |
| 63 | } |
| 64 | ctx.WriteString(" EXECUTE FUNCTION ") |
| 65 | ctx.FormatNode(node.FuncName) |
| 66 | ctx.WriteString("(") |
| 67 | for i, arg := range node.FuncArgs { |
| 68 | if i > 0 { |
| 69 | ctx.WriteString(", ") |
| 70 | } |
| 71 | ctx.FormatStringConstant(arg) |
| 72 | } |
| 73 | ctx.WriteString(")") |
| 74 | } |
| 75 | |
| 76 | type TriggerActionTime uint8 |
| 77 |
nothing calls this directly
no test coverage detected