// Exists checks if a model instance exists in the database by its ID
164714
func (r *RepositoryService) Exists(model interface{}, id int) bool {
	db, err := r.Connections.Make()

	if err != nil {
		return false
	}

	itemCount := 0
	db.Model(model).Where("id = ?", id).Count(&itemCount)

	return itemCount > 0
}
1335725
func (lir *LookupInResult) Exists(idx int) bool {
	return lir.contents[idx].exists()
}
542082
func Exists(field *gentypes.FieldType) interface{} {
	//u.Debugf("exists?  nested?%v  for %s", field.Nested(), field.String())
	if field.Nested() {
		/*
			"nested": {
				"query": {
				    "term": {
				        "map_actioncounts.k": "Web hit"
				    }
				},
				"path": "map_actioncounts"
			}
		*/
		return &nested{&NestedQuery{
			Query: Term(field.Path+".k", field.Field),
			Path:  field.Path,
		}}
		//Nested(field.Path, &term{map[string][]string{"k": field.Field}})
	}
	return &exists{map[string]string{"field": field.Field}}
}
585543
func (o *queryM2M) Exist(md interface{}) bool {
	fi := o.fi
	return o.qs.Filter(fi.reverseFieldInfo.name, o.md).
		Filter(fi.reverseFieldInfoTwo.name, md).Exist()
}
896138
func (json *JSON) Exists(name string) bool {
	return json.fetch(name).Exists()
}
1007013
func (e *Entity) Exists(name string) bool {
	return e.Get(name) != nil
}
27176
func (instanceApi *InstanceApi) Exists(id string) (bool, error) {
	_, err := instanceApi.Get(id)
	if err != nil {
		if ccaError, ok := err.(api.CcaErrorResponse); ok && ccaError.StatusCode == 404 {
			return false, nil
		}
		return false, err
	}
	return true, nil
}
256676
func (r *Store) Exists(ctx context.Context, name string) bool {
	_, store, name := r.getStore(ctx, name)
	return store.Exists(ctx, name)
}
794282
func Exists(set []string, find string) bool {
	for _, s := range set {
		if s == find {
			return true
		}
	}
	return false
}
463636
func (m *Manager) Exists(contractID string) (bool, error) {
	count, err := m.collection.Find(bson.M{"contractid": contractID}).Count()
	return count >= 1, err
}
101655
func (s *Store) Exists(ctx context.Context, name string) bool {
	_, err := s.Get(ctx, name)
	return err == nil
}
1285386
func (d *Driver) Exists(id string) bool {
	return d.DeviceSet.HasDevice(id)
}
792577
func (daemon *Daemon) Exists(id string) bool {
	c, _ := daemon.GetContainer(id)
	return c != nil
}
1299468
func (om *OrdMap) Exists(key interface{}) bool {
	rkey := ty.AssertType(key, om.ktype)
	return om.exists(rkey)
}
40373
func (s *StoreToDeploymentLister) Exists(deployment *extensions.Deployment) (bool, error) {
	_, exists, err := s.Store.Get(deployment)
	if err != nil {
		return false, err
	}
	return exists, nil
}
993339
func (s *DbSession) Exists(query Q, document Document) (bool, error) {
	q := s.findQuery(document, query)
	if err := q.Select(bson.M{"_id": 1}).Limit(1).One(document); err != nil {
		if err.Error() == mgo.ErrNotFound.Error() {
			return false, nil
		}
		return false, err
	}
	return true, nil
}
443115
func (m *InMem) Exists(ctx context.Context, name string) bool {
	m.Lock()
	defer m.Unlock()

	_, found := m.data[name]
	return found
}