当前位置: 首页>>代码示例>>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;未经允许,请勿转载。