MCPcopy Index your code
hub / github.com/bytebase/bytebase / ListDatabaseNamesFunc

Method ListDatabaseNamesFunc

backend/api/lsp/completion.go:158–175  ·  view source on GitHub ↗
(ctx context.Context, instanceID string)

Source from the content-addressed store, hash-verified

156}
157
158func (h *Handler) ListDatabaseNamesFunc(ctx context.Context, instanceID string) ([]string, error) {
159 if instanceID == "" {
160 return nil, errors.Errorf("instance is not specified")
161 }
162
163 databases, err := h.store.ListDatabases(ctx, &store.FindDatabaseMessage{
164 Workspace: common.GetWorkspaceIDFromContext(ctx),
165 InstanceID: &instanceID,
166 })
167 if err != nil {
168 return nil, errors.Wrap(err, "failed to list databases")
169 }
170 var names []string
171 for _, database := range databases {
172 names = append(names, database.DatabaseName)
173 }
174 return names, nil
175}

Callers 5

buildSpanCatalogMethod · 0.80
findTableSchemaMethod · 0.80
findTableSchemaMethod · 0.80
DatabaseExistsFunction · 0.80

Calls 3

ErrorfMethod · 0.80
ListDatabasesMethod · 0.65

Tested by

no test coverage detected