MCPcopy Create free account
hub / github.com/go-pg/pg / AppendString

Function AppendString

types/append.go:121–149  ·  view source on GitHub ↗
(b []byte, s string, flags int)

Source from the content-addressed store, hash-verified

119}
120
121func AppendString(b []byte, s string, flags int) []byte {
122 if hasFlag(flags, arrayFlag) {
123 return appendString2(b, s, flags)
124 }
125
126 if hasFlag(flags, quoteFlag) {
127 b = append(b, '\'')
128 for _, c := range s {
129 if c == '\000' {
130 continue
131 }
132
133 if c == '\'' {
134 b = append(b, '\'', '\'')
135 } else {
136 b = appendRune(b, c)
137 }
138 }
139 b = append(b, '\'')
140 return b
141 }
142
143 for _, c := range s {
144 if c != '\000' {
145 b = appendRune(b, c)
146 }
147 }
148 return b
149}
150
151func appendString2(b []byte, s string, flags int) []byte {
152 b = append(b, '"')

Callers 9

AppendValueMethod · 0.92
newFieldMethod · 0.92
appendColumnsMethod · 0.92
AppendValueMethod · 0.85
AppendFunction · 0.85
appendStringValueFunction · 0.85
appendIPValueFunction · 0.85
appendIPNetValueFunction · 0.85

Calls 3

appendString2Function · 0.85
appendRuneFunction · 0.85
hasFlagFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…