MCPcopy Index your code
hub / github.com/Masterminds/squirrel / When

Method When

case.go:119–123  ·  view source on GitHub ↗

When adds "WHEN ... THEN ..." part to CASE construct

(when interface{}, then interface{})

Source from the content-addressed store, hash-verified

117
118// When adds "WHEN ... THEN ..." part to CASE construct
119func (b CaseBuilder) When(when interface{}, then interface{}) CaseBuilder {
120 // TODO: performance hint: replace slice of WhenPart with just slice of parts
121 // where even indices of the slice belong to "when"s and odd indices belong to "then"s
122 return builder.Append(b, "WhenParts", newWhenPart(when, then)).(CaseBuilder)
123}
124
125// What sets optional "ELSE ..." part for CASE construct
126func (b CaseBuilder) Else(expr interface{}) CaseBuilder {

Callers 6

TestUpdateBuilderToSqlFunction · 0.80
TestCaseWithValFunction · 0.80
TestCaseWithComplexValFunction · 0.80
TestCaseWithNoValFunction · 0.80
TestCaseWithExprFunction · 0.80
TestMultipleCaseFunction · 0.80

Calls 1

newWhenPartFunction · 0.85

Tested by 6

TestUpdateBuilderToSqlFunction · 0.64
TestCaseWithValFunction · 0.64
TestCaseWithComplexValFunction · 0.64
TestCaseWithNoValFunction · 0.64
TestCaseWithExprFunction · 0.64
TestMultipleCaseFunction · 0.64