// exists returns true if a soft or hard deletable item exists in the database table with a given ID
777809
func exists(ctx context.Context, db *gorm.DB, tableName, idColumnName, id string, softDeletable bool) (bool, error) {
	var exists bool
	var query string
	if softDeletable {
		query = fmt.Sprintf(`
		SELECT EXISTS (
			SELECT 1 FROM %[1]s
			WHERE
				%[2]s=$1
				AND deleted_at IS NULL
		)`, tableName, idColumnName)
	} else {
		query = fmt.Sprintf(`
		SELECT EXISTS (
			SELECT 1 FROM %[1]s
			WHERE
				%[2]s=$1
		)`, tableName, idColumnName)
	}
	err := db.CommonDB().QueryRow(query, id).Scan(&exists)
	if err == nil && !exists {
		return exists, errors.NewNotFoundError(tableName, id)
	}
	if err != nil {
		return false, errors.NewInternalError(ctx, errs.Wrapf(err, "unable to verify if %s exists", tableName))
	}
	return exists, nil
}
1064850
func (nsRefcounts_) exists(coll mongo.Collection, key string) (bool, error) {
	count, err := coll.FindId(key).Count()
	if err != nil {
		return false, errors.Trace(err)
	}
	return count != 0, nil
}
392588
func (list *TargetList) Exists(id TargetID) bool {
	list.RLock()
	defer list.RUnlock()

	_, found := list.targets[id]
	return found
}
851577
func (s *StoreToReplicaSetLister) Exists(rs *extensions.ReplicaSet) (bool, error) {
	_, exists, err := s.Store.Get(rs)
	if err != nil {
		return false, err
	}
	return exists, nil
}
629440
func (s *StoreToJobLister) Exists(job *extensions.Job) (bool, error) {
	_, exists, err := s.Store.Get(job)
	if err != nil {
		return false, err
	}
	return exists, nil
}
1183478
func (m *Manager) Exists(username string, applicationid string) (bool, error) {
	count, err := m.getCollection().Find(bson.M{"username": username, "applicationid": applicationid}).Count()

	return count == 1, err
}
1203669
func (db *DB) Exists(key []byte) (int64, error) {
	if err := checkKeySize(key); err != nil {
		return 0, err
	}

	var err error
	key = db.encodeKVKey(key)

	var v []byte
	v, err = db.bucket.Get(key)
	if v != nil && err == nil {
		return 1, nil
	}

	return 0, err
}
362199
func (z *zookeeperKV) exists(key string) (bool, error) {
	key = z.domain + normalize(key)
	exists, _, err := z.client.Exists(key)
	if err != nil {
		return false, err
	}
	return exists, nil
}
650346
func (d *Driver) Exists(id string) bool {
	_, err := os.Lstat(d.dir(id))
	logrus.Debugf("lcowdriver: exists: id %s %t", id, err == nil)
	return err == nil
}
443115
func (m *InMem) Exists(ctx context.Context, name string) bool {
	m.Lock()
	defer m.Unlock()

	_, found := m.data[name]
	return found
}
754998
func (s *StoreToPodLister) Exists(pod *api.Pod) (bool, error) {
	_, exists, err := s.Store.Get(pod)
	if err != nil {
		return false, err
	}
	return exists, nil
}
513075
func (cfs *cacheFSObjects) Exists(ctx context.Context, bucket, object string) bool {
	_, err := cfs.GetObjectInfo(ctx, bucket, object, ObjectOptions{})
	return err == nil
}
140546
func (a *Driver) Exists(id string) bool {
	if _, err := os.Lstat(path.Join(a.rootPath(), "layers", id)); err != nil {
		return false
	}
	return true
}
1007013
func (e *Entity) Exists(name string) bool {
	return e.Get(name) != nil
}
610359
func (c *Collection) Exists(id string) (bool, error) {
	t := c.pool.NewTransaction()
	exists := false
	t.Exists(c, id, &exists)
	if err := t.Exec(); err != nil {
		return false, err
	}
	return exists, nil
}
794282
func Exists(set []string, find string) bool {
	for _, s := range set {
		if s == find {
			return true
		}
	}
	return false
}
960497
func (doc *Document) Exists() ([]byte, error) {
	// Use the get operation to get it.
	body, err := doc.Db.Req.Get(doc.Id, nil)

	if err != nil {
		return nil, err
	} else {
		result := &struct {
			Error string `json:"error"`
			Ok    bool   `json:"ok"`
			Id    string `json:"_id"`
			Rev   string `json:"_rev"`
		}{}
		err = json.Unmarshal(body, result)
		if err != nil {
			return nil, err
		}

		if result.Error != "" {
			return nil, errors.New(result.Error)
		}
		doc.Id = result.Id
		doc.Rev = result.Rev
	}
	return body, nil
}