Debian Codegraph @

clause/locking.go

raw
1 package clause
2
3 const (
4 LockingStrengthUpdate = "UPDATE"
5 LockingStrengthShare = "SHARE"
6 LockingOptionsSkipLocked = "SKIP LOCKED"
7 LockingOptionsNoWait = "NOWAIT"
8 )
9
10 type Locking struct {
11 Strength string
12 Table Table
13 Options string
14 }
15
16 // Name where clause name
17 func (locking Locking) Name() string {
18 return "FOR"
19 }
20
21 // Build build where clause
22 func (locking Locking) Build(builder Builder) {
23 builder.WriteString(locking.Strength)
24 if locking.Table.Name != "" {
25 builder.WriteString(" OF ")
26 builder.WriteQuoted(locking.Table)
27 }
28
29 if locking.Options != "" {
30 builder.WriteByte(' ')
31 builder.WriteString(locking.Options)
32 }
33 }
34
35 // MergeClause merge order by clauses
36 func (locking Locking) MergeClause(clause *Clause) {
37 clause.Expression = locking
38 }