// IndexExists tests if an index exists for the passed in field name
12537
func (s *Store) IndexExists(tx *bolt.Tx, typeName, indexName string) bool {
	return (tx.Bucket(indexBucketName(typeName, indexName)) != nil)
}
791764
func FileExists(filePath string) (bool, int64, error) {
	fileInfo, err := os.Stat(filePath)
	if os.IsNotExist(err) {
		return false, 0, nil
	}
	if err != nil {
		return false, 0, errors.Wrapf(err, "error checking if file [%s] exists", filePath)
	}
	return true, fileInfo.Size(), nil
}
282785
func (n *node) KeyExists(bucketName string, key interface{}) (bool, error) {
	id, err := toBytes(key, n.codec)
	if err != nil {
		return false, err
	}

	var exists bool
	return exists, n.readTx(func(tx *bolt.Tx) error {
		bucket := n.GetBucket(tx, bucketName)
		if bucket == nil {
			return ErrNotFound
		}

		v := bucket.Get(id)
		if v != nil {
			exists = true
		}

		return nil
	})
}
1283280
func (c *FileCacher) IsExist(key string) bool {
	return com.IsExist(c.filepath(key))
}
1130635
func NewIndicesExistsTypeService(client *Client) *IndicesExistsTypeService {
	return &IndicesExistsTypeService{
		client: client,
		index:  make([]string, 0),
		typ:    make([]string, 0),
	}
}
1359967
func (r *GormRepository) CheckExists(ctx context.Context, id uuid.UUID) error {
	return repository.CheckExists(ctx, r.db, SpaceTemplate{}.TableName(), id)
}
93725
func (m *GormCommentRepository) CheckExists(ctx context.Context, id uuid.UUID) error {
	defer goa.MeasureSince([]string{"goa", "db", "comment", "exists"}, time.Now())
	return repository.CheckExists(ctx, m.db, Comment{}.TableName(), id)
}
1092394
func (rd *RAMDirectory) FileExists(name string) bool {
	rd.EnsureOpen()
	rd.fileMapLock.RLock()
	defer rd.fileMapLock.RUnlock()
	_, ok := rd.fileMap[name]
	return ok
}
831587
func resourceExists(root, path string) bool {
	_, err := os.Stat(root + path)
	// technically we should use os.IsNotExist(err)
	// but we don't handle any other kinds of errors anyway
	return err == nil
}
306325
func (r *GormTrackerQueryRepository) CheckExists(ctx context.Context, id uuid.UUID) error {
	return repository.CheckExists(ctx, r.db, trackerQueriesTableName, id)
}
66929
func (db *Database) DbExists() error {
	resp, err := db.connection.request("HEAD", "/"+db.dbName, nil, nil, db.auth)
	if err != nil {
		if resp != nil {
			resp.Body.Close()
		}
	}
	return err
}
168486
func macroExists(m string) bool {
	_, err := os.Stat(path.Join(profileDirectory, m))
	return err == nil
}
763431
func (r *RedisCache) IsExist(key string) bool {
	v, err := redigo.Bool(r.do("EXISTS", key))
	if err != nil {
		return false
	}
	return v
}
418126
func (db *DB) LKeyExists(key []byte) (int64, error) {
	if err := checkKeySize(key); err != nil {
		return 0, err
	}
	sk := db.lEncodeMetaKey(key)
	v, err := db.bucket.Get(sk)
	if v != nil && err == nil {
		return 1, nil
	}
	return 0, err
}
325968
func PathExists(conn client.Connection, p string) (bool, error) {
	exists, err := conn.Exists(p)
	if err == client.ErrNoNode {
		return false, nil
	}
	return exists, err
}
824698
func (r *GormBoardRepository) CheckExists(ctx context.Context, id uuid.UUID) error {
	log.Debug(ctx, map[string]interface{}{"board_id": id}, "checking if work item board exists")
	return repository.CheckExists(ctx, r.db, Board{}.TableName(), id)
}
1201778
func (b *BlockChain) blockExists(hash *chainhash.Hash) (bool, error) {
	// Check block index first (could be main chain or side chain blocks).
	if b.index.HaveBlock(hash) {
		return true, nil
	}

	// Check in the database.
	var exists bool
	err := b.db.View(func(dbTx database.Tx) error {
		var err error
		exists, err = dbTx.HasBlock(hash)
		if err != nil || !exists {
			return err
		}

		// Ignore side chain blocks in the database.  This is necessary
		// because there is not currently any record of the associated
		// block index data such as its block height, so it's not yet
		// possible to efficiently load the block and do anything useful
		// with it.
		//
		// Ultimately the entire block index should be serialized
		// instead of only the current main chain so it can be consulted
		// directly.
		_, err = dbFetchHeightByHash(dbTx, hash)
		if isNotInMainChainErr(err) {
			exists = false
			return nil
		}
		return err
	})
	return exists, err
}