MCPcopy
hub / github.com/go-gorm/gorm / ToString

Function ToString

utils/utils.go:146–172  ·  view source on GitHub ↗
(value interface{})

Source from the content-addressed store, hash-verified

144}
145
146func ToString(value interface{}) string {
147 switch v := value.(type) {
148 case string:
149 return v
150 case int:
151 return strconv.FormatInt(int64(v), 10)
152 case int8:
153 return strconv.FormatInt(int64(v), 10)
154 case int16:
155 return strconv.FormatInt(int64(v), 10)
156 case int32:
157 return strconv.FormatInt(int64(v), 10)
158 case int64:
159 return strconv.FormatInt(v, 10)
160 case uint:
161 return strconv.FormatUint(uint64(v), 10)
162 case uint8:
163 return strconv.FormatUint(uint64(v), 10)
164 case uint16:
165 return strconv.FormatUint(uint64(v), 10)
166 case uint32:
167 return strconv.FormatUint(uint64(v), 10)
168 case uint64:
169 return strconv.FormatUint(v, 10)
170 }
171 return ""
172}
173
174const nestedRelationSplit = "__"
175

Callers 3

ExplainSQLFunction · 0.92
setupValuerAndSetterMethod · 0.92
TestToStringFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestToStringFunction · 0.68