MCPcopy
hub / github.com/writefreely/writefreely / String

Method String

db/create.go:171–202  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169}
170
171func (c *Column) String() (string, error) {
172 var str strings.Builder
173
174 str.WriteString(c.Name)
175
176 str.WriteString(" ")
177 typeStr, err := c.Type.Format(c.Dialect, c.Size)
178 if err != nil {
179 return "", err
180 }
181
182 str.WriteString(typeStr)
183
184 if !c.Nullable {
185 str.WriteString(" NOT NULL")
186 }
187
188 if c.Default.Set {
189 str.WriteString(" DEFAULT ")
190 val := c.Default.Value
191 if val == "" {
192 val = "''"
193 }
194 str.WriteString(val)
195 }
196
197 if c.PrimaryKey {
198 str.WriteString(" PRIMARY KEY")
199 }
200
201 return str.String(), nil
202}
203
204func (b *CreateTableSqlBuilder) Column(column *Column) *CreateTableSqlBuilder {
205 if b.Columns == nil {

Callers 15

TestColumn_BuildFunction · 0.95
buildLoginURLMethod · 0.80
TestViewOauthCallbackFunction · 0.80
buildLoginURLMethod · 0.80
FetchLastAccessTokenMethod · 0.80
UpdateCollectionMethod · 0.80
disableYoutubeAutoplayFunction · 0.80
buildLoginURLMethod · 0.80
parsePostIDFromURLFunction · 0.80
buildLoginURLMethod · 0.80

Calls 1

FormatMethod · 0.80

Tested by 3

TestColumn_BuildFunction · 0.76
TestViewOauthCallbackFunction · 0.64
newTestDatabaseFunction · 0.64