Пример #1
0
func (handler *serviceHandler)findAllServices(request *restful.Request, response *restful.Response){
    serviceList, err := dao.GetAllService()
    if err != nil{
        response.WriteError(http.StatusInternalServerError, err)
        return
    }
    response.WriteEntity(serviceList)
}
Пример #2
0
func (handler *serviceHandler)findAllServiceNames(request *restful.Request, response *restful.Response){
    serviceList, err := dao.GetAllService()
    if err != nil{
        response.WriteError(http.StatusInternalServerError, err)
        return
    }

    serviceNameList := make([]string, 0)
    for _, service := range serviceList {
        serviceNameList = append(serviceNameList, service.Name)
    }
    response.WriteEntity(serviceNameList)
}