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


Golang utils.NewApiError函數代碼示例

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


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

示例1: EditInvitee

func (is inviteeService) EditInvitee(updateMe entities.Invitee) utils.Error {
	err := is.da.UpdateInvitee(updateMe)

	if err != nil {
		return utils.NewApiError(500, err.Error())
	}

	return nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:invitees.go

示例2: GetEventInfo

func (es eventsService) GetEventInfo(eventId string) (entities.Event, utils.Error) {
	event, err := es.da.GetEventInfo(eventId)

	if err != nil {
		return entities.Event{}, utils.NewApiError(500, err.Error())
	}

	return event, nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:events.go

示例3: GetSeatingRequestInviteesForEvent

func (is inviteeService) GetSeatingRequestInviteesForEvent(eventID string) ([]entities.Invitee, utils.Error) {
	toReturn, err := is.da.GetSeatingRequestInviteesForEvent(eventID)

	if err != nil {
		return []entities.Invitee{}, utils.NewApiError(500, err.Error())
	}

	return toReturn, nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:invitees.go

示例4: GetListOfSeatingRequestChoices

func (c Coordinator) GetListOfSeatingRequestChoices(eventID string) ([]entities.SeatingRequestChoice, utils.Error) {
	iList, err := c.invitees.GetSeatingRequestInviteesForEvent(eventID)

	if err != nil {
		return []entities.SeatingRequestChoice{}, utils.NewApiError(500, err.Error())
	}

	return c.encryptInviteesToSeatingRequestChoiceList(iList)
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:core.go

示例5: GetNumAttendingForEvent

func (es eventsService) GetNumAttendingForEvent(eventID string) (int, utils.Error) {
	num, err := es.da.GetNumAttendingForEvent(eventID)

	if err != nil {
		return 0, utils.NewApiError(500, err.Error())
	}

	return num, nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:events.go

示例6: CreateInviteeFriend

func (is inviteeService) CreateInviteeFriend(friend *entities.InviteeFriend) utils.Error {
	err := is.da.CreateInviteeFriend(friend)

	if err != nil {
		return utils.NewApiError(500, err.Error())
	}

	return nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:invitees.go

示例7: IsUserAnAdminForEvent

func (es eventsService) IsUserAnAdminForEvent(userID string, eventID string) (bool, utils.Error) {
	eAdmin, err := es.da.GetEventAdminRecordForUserAndEventID(userID, eventID)

	if err != nil && err.Error() != "record not found" {
		return false, utils.NewApiError(500, err.Error())
	}

	return eAdmin.EventAdminID != "", nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:events.go

示例8: GetMenuItemsForEvent

// GetMenuItemsForEvent gets the menu items based on the event id
// eventID. It returns a slice of menu items and any errors that occured.
func (es eventsService) GetMenuItemsForEvent(eventID string) ([]entities.MenuItem, utils.Error) {
	items, err := es.da.GetMenuItemsForEvent(eventID)

	if err != nil {
		return []entities.MenuItem{}, utils.NewApiError(500, err.Error())
	}

	return items, nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:11,代碼來源:events.go

示例9: CreateEvent

func (es eventsService) CreateEvent(event *entities.Event, userID string) utils.Error {
	err := es.da.CreateEvent(event, userID)

	if err != nil {
		return utils.NewApiError(500, err.Error())
	}

	return nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:events.go

示例10: GetInviteeFromID

func (is inviteeService) GetInviteeFromID(id string) (entities.Invitee, utils.Error) {
	invitee, err := is.da.GetInviteeFromID(id)

	if err != nil {
		return entities.Invitee{}, utils.NewApiError(500, err.Error())
	}

	return invitee, nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:invitees.go

示例11: GetEvents

func (es eventsService) GetEvents(userID string) ([]entities.Event, utils.Error) {
	events, err := es.da.GetAllEvents(userID)

	if err != nil {
		return []entities.Event{}, utils.NewApiError(500, err.Error())
	}

	return events, nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:9,代碼來源:events.go

示例12: GetEventStats

func (c Coordinator) GetEventStats(eventID string, userID string) (EventStats, utils.Error) {
	// make sure the user is an admin for this event
	isAdmin, err := c.events.IsUserAnAdminForEvent(userID, eventID)

	if err != nil {
		return EventStats{}, err
	} else if !isAdmin {
		return EventStats{}, utils.NewApiError(403, "You are not authorized to view the list of invitees for this event!")
	}

	stats := EventStats{}

	stats.NumAttending, err = c.events.GetNumAttendingForEvent(eventID)
	if err != nil {
		return EventStats{}, utils.NewApiError(500, "Error getting stats!")
	}

	return stats, nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:19,代碼來源:core.go

示例13: GetInviteesForEvent

func (is inviteeService) GetInviteesForEvent(eventId string, p *PaginationService) ([]entities.Invitee, utils.Error) {
	invitees, err := is.da.GetAllInviteesForEvent(eventId, p.GetStartNumber(), p.GetSize())

	p.SetNumItems(is.da.GetNumberOfInviteesForEvent(eventId))

	if err != nil {
		return []entities.Invitee{}, utils.NewApiError(500, err.Error())
	}

	return invitees, nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:11,代碼來源:invitees.go

示例14: CreateInviteeForEvent

func (is inviteeService) CreateInviteeForEvent(invitee *entities.Invitee, event entities.Event) utils.Error {
	invitee.FkEventID = event.EventID

	err := is.da.CreateInvitee(invitee)

	if err != nil {
		return utils.NewApiError(500, err.Error())
	}

	return nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:11,代碼來源:invitees.go

示例15: encryptSeatingRequestChoice

func (c Coordinator) encryptSeatingRequestChoice(choice entities.SeatingRequestChoice) (entities.SeatingRequestChoice, utils.Error) {
	var err error

	choice.FkInviteeRequestID, err = c.encryptFkInviteeRequestID(choice.FkInviteeRequestID)

	if err != nil {
		return entities.SeatingRequestChoice{}, utils.NewApiError(500, err.Error())
	}

	return choice, nil
}
開發者ID:grounded042,項目名稱:capacious,代碼行數:11,代碼來源:core.go


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