MCPcopy Create free account
hub / github.com/dolthub/doltgresql / DebugString

Method DebugString

core/rootvalue.go:159–253  ·  view source on GitHub ↗

DebugString implements the interface doltdb.RootValue.

(ctx context.Context, transitive bool)

Source from the content-addressed store, hash-verified

157
158// DebugString implements the interface doltdb.RootValue.
159func (root *RootValue) DebugString(ctx context.Context, transitive bool) string {
160 var buf bytes.Buffer
161 buf.WriteString(root.st.DebugString(ctx))
162
163 if transitive {
164 buf.WriteString("\nTables:")
165 root.IterTables(ctx, func(name doltdb.TableName, table *doltdb.Table, sch schema.Schema) (stop bool, err error) {
166 buf.WriteString("\nTable ")
167 buf.WriteString(name.Name)
168 buf.WriteString(":\n")
169
170 buf.WriteString(table.DebugString(ctx, root.ns))
171
172 return false, nil
173 })
174
175 buf.WriteString("\nSchemas:")
176 schemas, err := root.GetDatabaseSchemas(ctx)
177 if err != nil {
178 return ""
179 }
180
181 for _, schema := range schemas {
182 buf.WriteString("\nSchema ")
183 buf.WriteString(schema.Name)
184 }
185
186 fkc, err := root.GetForeignKeyCollection(ctx)
187 if err == nil && fkc.Count() > 0 {
188 buf.WriteString("\nForeign Keys:")
189 fkc.Iter(func(fk doltdb.ForeignKey) (stop bool, err error) {
190 buf.WriteString("\n")
191 buf.WriteString(fk.Name)
192 buf.WriteString(": ")
193 buf.WriteString(fk.TableName.String())
194 buf.WriteString("(")
195 for i, tag := range fk.ReferencedTableColumns {
196 if i > 0 {
197 buf.WriteString(",")
198 }
199 buf.WriteString(strconv.Itoa(int(tag)))
200 }
201 buf.WriteString(") ON ")
202 buf.WriteString(fk.ReferencedTableName.String())
203 buf.WriteString("(")
204 for i, tag := range fk.ReferencedTableColumns {
205 if i > 0 {
206 buf.WriteString(",")
207 }
208 buf.WriteString(strconv.Itoa(int(tag)))
209 }
210 buf.WriteString(")\n")
211 return false, nil
212 })
213 }
214
215 seqs, err := sequences.LoadSequences(ctx, root)
216 if err != nil {

Callers

nothing calls this directly

Calls 12

IterTablesMethod · 0.95
GetDatabaseSchemasMethod · 0.95
LoadSequencesFunction · 0.92
WriteStringMethod · 0.80
IterateSequencesMethod · 0.80
StringMethod · 0.65
NameMethod · 0.65
CountMethod · 0.45
IterMethod · 0.45
ErrorMethod · 0.45
AsIdMethod · 0.45

Tested by

no test coverage detected