// listDatabases returns a list of databases using a GET to the given path.
960843
func listDatabases(ctx context.Context, conn Connection, path string) ([]Database, error) {
	req, err := conn.NewRequest("GET", path)
	if err != nil {
		return nil, WithStack(err)
	}
	resp, err := conn.Do(ctx, req)
	if err != nil {
		return nil, WithStack(err)
	}
	if err := resp.CheckStatus(200); err != nil {
		return nil, WithStack(err)
	}
	var data getDatabaseResponse
	if err := resp.ParseBody("", &data); err != nil {
		return nil, WithStack(err)
	}
	result := make([]Database, 0, len(data.Result))
	for _, name := range data.Result {
		db, err := newDatabase(name, conn)
		if err != nil {
			return nil, WithStack(err)
		}
		result = append(result, db)
	}
	return result, nil
}
725016
func Get(dbName string) (Db, error) {
	if db, ok := connectionMap[dbName]; ok {
		return db, nil
	}
	return Db{}, errors.New("Database connection not available. Perform 'Setup' first")
}
581802
func (dao *ControlPlaneDao) ListSnapshots(serviceID string, snapshots *[]model.SnapshotInfo) (err error) {
	ctx := datastore.Get()

	// synchronize the dfs
	dfslocker := dao.facade.DFSLock(ctx)
	dfslocker.Lock("list snapshots")
	defer dfslocker.Unlock()

	*snapshots = make([]model.SnapshotInfo, 0)
	snapshotIDs, err := dao.facade.ListSnapshots(ctx, serviceID)
	if err != nil {
		return err
	}
	for _, snapshotID := range snapshotIDs {
		var newInfo model.SnapshotInfo

		info, err := dao.facade.GetSnapshotInfo(ctx, snapshotID)
		if err == volume.ErrInvalidSnapshot {
			newInfo = model.SnapshotInfo{
				SnapshotID: snapshotID,
				Invalid:    true,
			}

		} else if err != nil {
			return err
		} else {
			newInfo = model.SnapshotInfo{
				SnapshotID:  info.Name,
				TenantID:    info.TenantID,
				Description: info.Message,
				Tags:        info.Tags,
				Created:     info.Created,
				Invalid:     false,
			}
		}
		*snapshots = append(*snapshots, newInfo)
	}
	return
}
1320548
func NewDatabase(path string) (Database, error) {
	storage, err := util.NewFileStorage(path)
	if err != nil {
		return nil, err
	}

	return NewDatabaseWithStorage(storage), nil
}
330399
func GetDatabaseName() string {
	envValue := os.Getenv(NDDatabaseName)
	if envValue != "" {
		databaseName = envValue
	}
	return databaseName
}
80935
func (obj *Global) GetDatabasesFromConnectionString(ctx context.Context, connection *Connection) ([]*Database, error) {
	result := &struct {
		Databases []*Database	`json:"qDatabases"`
	} {}
	err := obj.rpc(ctx, "GetDatabasesFromConnectionString", result, connection)
	return result.Databases, err 
}
1368663
func (d *dbBase) GetColumns(db dbQuerier, table string) (map[string][3]string, error) {
	columns := make(map[string][3]string)
	query := d.ins.ShowColumnsQuery(table)
	rows, err := db.Query(query)
	if err != nil {
		return columns, err
	}

	defer rows.Close()

	for rows.Next() {
		var (
			name string
			typ  string
			null string
		)
		err := rows.Scan(&name, &typ, &null)
		if err != nil {
			return columns, err
		}
		columns[name] = [3]string{name, typ, null}
	}

	return columns, nil
}
600965
func (c *Client) AllDB(ctx context.Context) ([]chronograf.Database, error) {
	return c.showDatabases(ctx)
}
455907
func (db *BytesConnectionRedis) ListValues(match string) (keyval.BytesKeyValIterator, error) {
	if db.closed {
		return nil, fmt.Errorf("ListValues(%s) called on a closed connection", match)
	}
	return listValues(db, match, nil, nil)
}
829577
func (obj *Doc) GetDatabaseOwners(ctx context.Context, connectionId string, database string) ([]*DatabaseOwner, error) {
	result := &struct {
		Owners []*DatabaseOwner	`json:"qOwners"`
	} {}
	err := obj.rpc(ctx, "GetDatabaseOwners", result, connectionId, database)
	return result.Owners, err 
}
1013610
func (obj *Global) GetDatabasesFromConnectionStringRaw(ctx context.Context, connection interface{}) (json.RawMessage, error) {
	result := &struct {
		Databases json.RawMessage	`json:"qDatabases"`
	} {}
	err := obj.rpc(ctx, "GetDatabasesFromConnectionString", result, ensureEncodable(connection))
	return result.Databases, err 
}
569415
func (ds *resourcesUnitDataStore) ListResources() (resource.ApplicationResources, error) {
	return ds.resources.ListResources(ds.unit.ApplicationName())
}
1306368
func (f *Facade) ListSnapshots(ctx datastore.Context, serviceID string) ([]string, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ListSnapshots"))
	logger := plog.WithField("serviceid", serviceID)
	tenantID, err := f.GetTenantID(ctx, serviceID)
	if err != nil {
		logger.WithError(err).Debug("Could not find tenant for service")
		return nil, err
	}
	logger = logger.WithField("tenantid", tenantID)
	snapshots, err := f.dfs.List(tenantID)
	if err != nil {
		logger.WithError(err).Debug("Could not list snapshots for tenant")
		return nil, err
	}
	return snapshots, nil
}
1000372
func (m *MemoryStore) ListFiles() []string {
	names := make([]string, 0, len(m.data))
	for n := range m.data {
		names = append(names, n)
	}
	return names
}
1173384
func listKeys(db keyval.ProtoBroker) {
	resp, err := db.ListKeys(phonebook.EtcdPath())
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("list keys:")
	for {
		key, _, stop := resp.GetNext()
		if stop {
			break
		}

		fmt.Printf("- %s\n", key)

	}
}
733208
func (d *domainClient) GetDatabaseTableNames(ctx context.Context, args *GetDatabaseTableNamesArgs) (reply *GetDatabaseTableNamesReply, err error) {
	reply = new(GetDatabaseTableNamesReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "Database.getDatabaseTableNames", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "Database.getDatabaseTableNames", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "Database", Op: "GetDatabaseTableNames", Err: err}
	}
	return
}
713829
func List(path string) ([]string, error) {
	return list(path, func(data []byte) (int, error) {
		return listxattr(path, data)
	})
}