// getDatabaseAndCollectionName returns database-name, collection-name from given access target.
549378
func getDatabaseAndCollectionName(col AccessTarget) (string, string, error) {
	if col == nil {
		return "*", "*", nil
	}
	if x, ok := col.(Collection); ok {
		return x.Database().Name(), x.Name(), nil
	}
	if x, ok := col.(Database); ok {
		return x.Name(), "*", nil
	}
	return "", "", WithStack(InvalidArgumentError{"Need Collection or Database or nil"})
}
772086
func (s *Crawler) SetDatabaseName(v string) *Crawler {
	s.DatabaseName = &v
	return s
}
330399
func GetDatabaseName() string {
	envValue := os.Getenv(NDDatabaseName)
	if envValue != "" {
		databaseName = envValue
	}
	return databaseName
}
175810
func (s *RestoreDBClusterFromS3Input) SetDatabaseName(v string) *RestoreDBClusterFromS3Input {
	s.DatabaseName = &v
	return s
}
270872
func (s *MongoDbSettings) SetDatabaseName(v string) *MongoDbSettings {
	s.DatabaseName = &v
	return s
}
128577
func (s *SchemaConfiguration) SetDatabaseName(v string) *SchemaConfiguration {
	s.DatabaseName = &v
	return s
}
1292248
func (s *TableRestoreStatus) SetTargetDatabaseName(v string) *TableRestoreStatus {
	s.TargetDatabaseName = &v
	return s
}
440875
func (f *Footer) ChildCollectionNames() ([]string, error) {
	var childNames = make([]string, len(f.ChildFooters))
	idx := 0
	for name := range f.ChildFooters {
		childNames[idx] = name
		idx++
	}
	return childNames, nil
}
712317
func (obj *Doc) GetDatabases(ctx context.Context, connectionId string) ([]*Database, error) {
	result := &struct {
		Databases []*Database	`json:"qDatabases"`
	} {}
	err := obj.rpc(ctx, "GetDatabases", result, connectionId)
	return result.Databases, err 
}
1211006
func (h *Service) GetDatabases(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()

	srcID, err := paramID("id", r)
	if err != nil {
		Error(w, http.StatusUnprocessableEntity, err.Error(), h.Logger)
		return
	}

	src, err := h.Store.Sources(ctx).Get(ctx, srcID)
	if err != nil {
		notFound(w, srcID, h.Logger)
		return
	}

	dbsvc := h.Databases
	if err = dbsvc.Connect(ctx, &src); err != nil {
		msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err)
		Error(w, http.StatusBadRequest, msg, h.Logger)
		return
	}

	databases, err := dbsvc.AllDB(ctx)
	if err != nil {
		Error(w, http.StatusBadRequest, err.Error(), h.Logger)
		return
	}

	dbs := make([]dbResponse, len(databases))
	for i, d := range databases {
		rps, err := h.allRPs(ctx, dbsvc, srcID, d.Name)
		if err != nil {
			Error(w, http.StatusBadRequest, err.Error(), h.Logger)
			return
		}
		dbs[i] = newDBResponse(srcID, d.Name, rps)
	}

	res := dbsResponse{
		Databases: dbs,
	}

	encodeJSON(w, http.StatusOK, res, h.Logger)
}
384736
func (s *RestoreTableFromClusterSnapshotInput) SetTargetDatabaseName(v string) *RestoreTableFromClusterSnapshotInput {
	s.TargetDatabaseName = &v
	return s
}
112018
func (s *Store) GetCollection(name string) *Collection {
	coll := *(*map[string]*Collection)(atomic.LoadPointer(&s.coll))
	return coll[name]
}
300242
func (s *CreateCrawlerInput) SetDatabaseName(v string) *CreateCrawlerInput {
	s.DatabaseName = &v
	return s
}
764623
func (s *Partition) SetDatabaseName(v string) *Partition {
	s.DatabaseName = &v
	return s
}
752929
func GetDatabaseType(db string) (DATABASE, error) {
	if mongoStr == db {
		return MONGODB, nil
	} else if mysqlStr == db {
		return MYSQL, nil
	} else {
		return INVALID, errors.New("Undefined Database Type")
	}
}
872597
func getObjectDatabase() (*gitobj.ObjectDatabase, error) {
	dir, err := git.GitCommonDir()
	if err != nil {
		return nil, errors.Wrap(err, "cannot open root")
	}
	return gitobj.FromFilesystem(filepath.Join(dir, "objects"), cfg.TempDir())
}
1298934
func (d *database) Collections(ctx context.Context) ([]Collection, error) {
	req, err := d.conn.NewRequest("GET", path.Join(d.relPath(), "_api/collection"))
	if err != nil {
		return nil, WithStack(err)
	}
	resp, err := d.conn.Do(ctx, req)
	if err != nil {
		return nil, WithStack(err)
	}
	if err := resp.CheckStatus(200); err != nil {
		return nil, WithStack(err)
	}
	var data getCollectionResponse
	if err := resp.ParseBody("", &data); err != nil {
		return nil, WithStack(err)
	}
	result := make([]Collection, 0, len(data.Result))
	for _, info := range data.Result {
		col, err := newCollection(info.Name, d)
		if err != nil {
			return nil, WithStack(err)
		}
		result = append(result, col)
	}
	return result, nil
}