當前位置: 首頁>>代碼示例>>Golang>>正文


Golang errors.NewNotFoundError函數代碼示例

本文整理匯總了Golang中github.com/apihub/apihub/errors.NewNotFoundError函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewNotFoundError函數的具體用法?Golang NewNotFoundError怎麽用?Golang NewNotFoundError使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewNotFoundError函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: FindPluginByNameAndService

func (m *Mem) FindPluginByNameAndService(pluginName string, service account.Service) (account.Plugin, error) {
	if plugin, ok := m.Plugins[service.Subdomain][pluginName]; !ok {
		return account.Plugin{}, errors.NewNotFoundError(errors.ErrPluginNotFound)
	} else {
		return plugin, nil
	}
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:7,代碼來源:mem.go

示例2: FindTeamByAlias

func (m *Mem) FindTeamByAlias(alias string) (account.Team, error) {
	if team, ok := m.Teams[alias]; !ok {
		return account.Team{}, errors.NewNotFoundError(errors.ErrTeamNotFound)
	} else {
		return team, nil
	}
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:7,代碼來源:mem.go

示例3: FindUserByEmail

func (m *Mem) FindUserByEmail(email string) (account.User, error) {
	if user, ok := m.Users[email]; !ok {
		return account.User{}, errors.NewNotFoundError(errors.ErrUserNotFound)
	} else {
		return user, nil
	}
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:7,代碼來源:mem.go

示例4: FindHookByName

func (m *Mem) FindHookByName(name string) (account.Hook, error) {
	if hook, ok := m.Hooks[name]; !ok {
		return account.Hook{}, errors.NewNotFoundError(errors.ErrHookNotFound)
	} else {
		return hook, nil
	}
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:7,代碼來源:mem.go

示例5: FindAppByClientId

func (m *Mem) FindAppByClientId(id string) (account.App, error) {
	if app, ok := m.Apps[id]; !ok {
		return account.App{}, errors.NewNotFoundError(errors.ErrAppNotFound)
	} else {
		return app, nil
	}
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:7,代碼來源:mem.go

示例6: FindServiceBySubdomain

func (m *Mem) FindServiceBySubdomain(subdomain string) (account.Service, error) {
	if service, ok := m.Services[subdomain]; !ok {
		return account.Service{}, errors.NewNotFoundError(errors.ErrServiceNotFound)
	} else {
		return service, nil
	}
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:7,代碼來源:mem.go

示例7: DeleteTeam

func (m *Mem) DeleteTeam(t account.Team) error {
	if _, ok := m.Teams[t.Alias]; !ok {
		return errors.NewNotFoundError(errors.ErrTeamNotFound)
	}

	delete(m.Teams, t.Alias)
	return nil
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:8,代碼來源:mem.go

示例8: DeleteUser

func (m *Mem) DeleteUser(u account.User) error {
	if _, ok := m.Users[u.Email]; !ok {
		return errors.NewNotFoundError(errors.ErrUserNotFound)
	}

	delete(m.Users, u.Email)
	return nil
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:8,代碼來源:mem.go

示例9: DeleteHook

func (m *Mem) DeleteHook(w account.Hook) error {
	if _, ok := m.Hooks[w.Name]; !ok {
		return errors.NewNotFoundError(errors.ErrHookNotFound)
	}

	delete(m.Hooks, w.Name)
	return nil
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:8,代碼來源:mem.go

示例10: DeletePluginsByService

func (m *Mem) DeletePluginsByService(service account.Service) error {
	if _, ok := m.Plugins[service.Subdomain]; !ok {
		return errors.NewNotFoundError(errors.ErrPluginNotFound)
	}

	delete(m.Plugins, service.Subdomain)
	return nil
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:8,代碼來源:mem.go

示例11: DeletePlugin

func (m *Mem) DeletePlugin(pc account.Plugin) error {
	if _, ok := m.Plugins[pc.Service][pc.Name]; !ok {
		return errors.NewNotFoundError(errors.ErrPluginNotFound)
	}

	delete(m.Plugins, pc.Name)
	return nil
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:8,代碼來源:mem.go

示例12: DeleteApp

func (m *Mem) DeleteApp(a account.App) error {
	if _, ok := m.Apps[a.ClientId]; !ok {
		return errors.NewNotFoundError(errors.ErrAppNotFound)
	}

	delete(m.Apps, a.ClientId)
	return nil
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:8,代碼來源:mem.go

示例13: DeleteService

func (m *Mem) DeleteService(s account.Service) error {
	if _, ok := m.Services[s.Subdomain]; !ok {
		return errors.NewNotFoundError(errors.ErrServiceNotFound)
	}

	delete(m.Services, s.Subdomain)
	return nil
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:8,代碼來源:mem.go

示例14: ChangePassword

// Updates the password for an existing account.
func (user *User) ChangePassword() error {
	if !user.Exists() {
		return errors.NewNotFoundError(errors.ErrUserNotFound)
	}

	user.hashPassword()
	return store.UpsertUser(*user)
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:9,代碼來源:user.go

示例15: DeleteHooksByTeam

func (m *Mem) DeleteHooksByTeam(team account.Team) error {
	found := false
	for _, wh := range m.Hooks {
		if wh.Team == team.Alias {
			delete(m.Hooks, wh.Name)
			found = true
		}
	}
	if !found {
		return errors.NewNotFoundError(errors.ErrTeamNotFound)
	}
	return nil
}
開發者ID:sinzone,項目名稱:apihub,代碼行數:13,代碼來源:mem.go


注:本文中的github.com/apihub/apihub/errors.NewNotFoundError函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。