// Get a registration by ID
// UnexpectedError - problem getting in database
// NotFound - no registration with the ID was found
332352
func (mc MongoClient) RegistrationById(id string) (contract.Registration, error) {
	reg, err := mc.registrationById(id)
	if err != nil {
		return contract.Registration{}, err
	}
	return reg.ToContract(), nil
}
81385
func (d *Dispatch) GetId(name string) (id int32, err error) {
	var dispid []int32
	dispid, err = d.Object.GetIDsOfName([]string{name})
	if err != nil {
		return
	}
	id = dispid[0]
	return
}
249544
func (r *AppRepo) Get(id string) (*App, error) {
	app := &App{}

	if err := r.DB.Get(app, "SELECT * FROM apps WHERE id=$1", id); err != nil {
		if err == sql.ErrNoRows {
			return app, ErrAppNotExist
		}
		return app, err
	}

	return app, nil
}
581480
func (r *rest) GetById(c *gin.Context) {
	userId, err := strconv.Atoi(c.Param("userId"))
	if err != nil {
		c.JSON(apihelper.BuildRequestError(err))
	}
	if resDTO, err := r.service.RetrieveUserInfoByUserId(uint(userId)); err != nil {
		c.JSON(apihelper.BuildResponseError(err))
	} else {
		c.JSON(http.StatusOK, resDTO)
	}
}
488261
func (d *DeploymentStatus) GetID() int64 {
	if d == nil || d.ID == nil {
		return 0
	}
	return *d.ID
}
1025752
func (p *PreReceiveHook) GetID() int64 {
	if p == nil || p.ID == nil {
		return 0
	}
	return *p.ID
}
383210
func (api *API) HostGetById(id string) (res *Host, err error) {
	hosts, err := api.HostsGet(Params{"hostids": id})
	if err != nil {
		return
	}

	if len(hosts) == 1 {
		res = &hosts[0]
	} else {
		e := ExpectedOneResult(len(hosts))
		err = &e
	}
	return
}
154488
func (r *RegistrationDB) AddRegistration(k Registration) {
	r.Lock()
	defer r.Unlock()
	_, ok := r.registrationMap[k]
	if !ok {
		r.registrationMap[k] = make(map[string]*Producer)
	}
}
267509
func (d *DataSource) GetByID(id int64) (Model, bool) {
	return d.GetBy(func(u Model) bool {
		return u.ID == id
	})
}
1121919
func getByID(c context.Context, id string) (*instances.Instance, error) {
	if vmtoken.Has(c) {
		return nil, status.Errorf(codes.PermissionDenied, "unauthorized user")
	}
	vm := &model.VM{
		ID: id,
	}
	switch err := datastore.Get(c, vm); {
	case err == datastore.ErrNoSuchEntity:
		return nil, status.Errorf(codes.NotFound, "no VM found with ID %q", id)
	case err != nil:
		return nil, errors.Annotate(err, "failed to fetch VM").Err()
	default:
		return toInstance(vm), nil
	}
}
964693
func (m *Migration) GetID() int64 {
	if m == nil || m.ID == nil {
		return 0
	}
	return *m.ID
}
302088
func (m *Milestone) GetID() int64 {
	if m == nil || m.ID == nil {
		return 0
	}
	return *m.ID
}
834026
func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, error) {
	u := fmt.Sprintf("user/%d", id)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	user := new(User)
	resp, err := s.client.Do(ctx, req, user)
	if err != nil {
		return nil, resp, err
	}

	return user, resp, nil
}
277762
func (e *Event) GetID() string {
	if e == nil || e.ID == nil {
		return ""
	}
	return *e.ID
}
599743
func (r *RepositoryInvitation) GetID() int64 {
	if r == nil || r.ID == nil {
		return 0
	}
	return *r.ID
}
272614
func (s *Restore) Registration(idx uint64, req *structs.RegisterRequest) error {
	if err := s.store.ensureRegistrationTxn(s.tx, idx, req); err != nil {
		return err
	}
	return nil
}
1224399
func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organization, *Response, error) {
	u := fmt.Sprintf("organizations/%d", id)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	organization := new(Organization)
	resp, err := s.client.Do(ctx, req, organization)
	if err != nil {
		return nil, resp, err
	}

	return organization, resp, nil
}