NonNull determines whether this param should be "not null" in its current state
()
| 84 | |
| 85 | // NonNull determines whether this param should be "not null" in its current state |
| 86 | func (p Param) NotNull() bool { |
| 87 | const null = false |
| 88 | const notNull = true |
| 89 | |
| 90 | if p.is(notNullable) { |
| 91 | return notNull |
| 92 | } |
| 93 | |
| 94 | if p.is(nullable) { |
| 95 | return null |
| 96 | } |
| 97 | |
| 98 | if p.is(inferredNotNull) { |
| 99 | return notNull |
| 100 | } |
| 101 | |
| 102 | if p.is(inferredNull) { |
| 103 | return null |
| 104 | } |
| 105 | |
| 106 | // This param is unspecified, so by default we choose nullable |
| 107 | // which matches the default behavior of most databases |
| 108 | return null |
| 109 | } |
| 110 | |
| 111 | // IsSlice returns whether this param is a sqlc.slice() param. |
| 112 | func (p Param) IsSqlcSlice() bool { |