• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang gin.Engine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/gin-gonic/gin.Engine的典型用法代码示例。如果您正苦于以下问题:Golang Engine类的具体用法?Golang Engine怎么用?Golang Engine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Engine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: PostLike

func PostLike(db gorm.DB, router *gin.Engine) {
	// POST /like
	// POST new like to database
	router.POST("/like", func(c *gin.Context) {
		var likeData model.LikeData
		if err := c.BindJSON(&likeData); err == nil {
			like := &model.Like{
				LikeData: likeData,
			}

			var x_user uint64
			if resp := c.Request.Header.Get(userHeader); resp != "" {
				conv_user, _ := strconv.ParseUint(resp, 10, 64)
				x_user = conv_user
				like.Trace.CreatedBy = x_user
				like.Trace.UpdatedBy = x_user
				if err := checkDataLike(like.LikeData); err {
					if err := db.Create(&like).Error; err != nil {
						c.AbortWithError(http.StatusBadRequest, err)
					} else {
						c.JSON(http.StatusCreated, like)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			} else {
				c.AbortWithStatus(http.StatusForbidden)
			}

		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:35,代码来源:like.go


示例2: prepareRoutes

func prepareRoutes(router *gin.Engine) {
	// Web Resources
	router.Static("/static", "web/dist")

	// API Routes
	api := router.Group("/api/v1")
	admin := api.Group("/admin")
	public := api.Group("/public")
	registered := api.Group("/")
	sameRegisteredUser := api.Group("/user")

	prepareMiddleware(admin, public, registered, sameRegisteredUser)

	admin.GET("/users", listUsers)
	admin.GET("/places", listPlaces)
	admin.POST("/places", createPlace)
	admin.POST("/events", createEvent)
	admin.PUT("/place/:placeId", updatePlace)
	admin.PUT("/event/:eventId", updateEvent)
	admin.DELETE("/event/:eventId", cancelEvent)

	sameRegisteredUser.GET("/:userId", getUser)
	sameRegisteredUser.PUT("/:userId", updateUser)
	sameRegisteredUser.DELETE("/:userId", disableUser)

	registered.POST("/buy/:seatId", buyTicket)

	public.GET("/place/:placeId", getPlace)
	public.GET("/events", listEvents)
	public.GET("/event/:eventId", getEvent)
	public.POST("/users", createUser) // TODO Checar, me huele raro......
	public.POST("/login", loginUser)
}
开发者ID:cultome,项目名称:tickets,代码行数:33,代码来源:routes.go


示例3: setTemplate

//setTemplate loads templates from rice box "views"
func setTemplate(router *gin.Engine) {
	box := rice.MustFindBox("views")
	tmpl := template.New("").Funcs(template.FuncMap{
		"isActive":      helpers.IsActive,
		"stringInSlice": helpers.StringInSlice,
		"dateTime":      helpers.DateTime,
		"recentPosts":   helpers.RecentPosts,
		"tags":          helpers.Tags,
		"archives":      helpers.Archives,
	})

	fn := func(path string, f os.FileInfo, err error) error {
		if f.IsDir() != true && strings.HasSuffix(f.Name(), ".html") {
			var err error
			tmpl, err = tmpl.Parse(box.MustString(path))
			if err != nil {
				return err
			}
		}
		return nil
	}

	err := box.Walk("", fn)
	if err != nil {
		panic(err)
	}
	router.SetHTMLTemplate(tmpl)
}
开发者ID:denisbakhtin,项目名称:ginblog,代码行数:29,代码来源:main.go


示例4: PutGroupAdmin

func PutGroupAdmin(db gorm.DB, router *gin.Engine) {
	// PUT /group_admin
	// Update group_admin data by id
	router.PUT("/group_admin/:id", func(c *gin.Context) {
		_id := c.Param("id")
		if id, err := strconv.ParseUint(_id, 10, 64); err == nil {
			var group_adminData model.GroupAdminData
			if err := c.BindJSON(&group_adminData); err == nil {
				group_admin := &model.GroupAdmin{
					GroupAdminData: group_adminData,
					GroupAdminId:   model.GroupAdminId{Id: id},
				}
				if err := checkDataGroupAdmin(group_admin.GroupAdminData); err {
					checkGroupAdmin := &model.GroupAdmin{
						GroupAdminData: group_adminData,
						GroupAdminId:   model.GroupAdminId{Id: id},
					}
					if err := db.First(checkGroupAdmin).Error; err == nil {
						db.Save(&group_admin)
						c.JSON(http.StatusOK, group_admin)
					} else {
						c.AbortWithStatus(http.StatusNotFound)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			}
		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:33,代码来源:group_admin.go


示例5: PutWallEntry

func PutWallEntry(db gorm.DB, router *gin.Engine) {
	// PUT /wall_entry
	// Update wall_entry data by id
	router.PUT("/wall_entry/:id", func(c *gin.Context) {
		_id := c.Param("id")
		if id, err := strconv.ParseUint(_id, 10, 64); err == nil {
			var wall_entryData model.WallEntryData
			if err := c.BindJSON(&wall_entryData); err == nil {
				wall_entry := &model.WallEntry{
					WallEntryData: wall_entryData,
					WallEntryId:   model.WallEntryId{Id: id},
				}
				if err := checkDataWallEntry(wall_entry.WallEntryData); err {
					checkWallEntry := &model.WallEntry{
						WallEntryData: wall_entryData,
						WallEntryId:   model.WallEntryId{Id: id},
					}
					if err := db.First(checkWallEntry).Error; err == nil {
						db.Save(&wall_entry)
						c.JSON(http.StatusOK, wall_entry)
					} else {
						c.AbortWithStatus(http.StatusNotFound)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			}
		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:33,代码来源:wall_entry.go


示例6: AddRepoRoutes

func AddRepoRoutes(s *store.Engine, r *gin.Engine) {
	r.GET("/users/:username/repos", func(c *gin.Context) {
		var repos []*Repo

		for _, repo := range s.State.Repos {
			if repo.RepoOwner.Username == c.Param("username") {
				repos = append(repos, repo)
			}
		}

		c.JSON(http.StatusOK, repos)
	})

	r.GET("/users/:username/repos/:reponame", func(c *gin.Context) {
		var repo *Repo

		for _, rp := range s.State.Repos {
			if rp.RepoOwner.Username == c.Param("username") &&
				rp.Name == c.Param("reponame") {
				repo = rp
				break
			}
		}

		c.JSON(http.StatusOK, repo)
	})
}
开发者ID:nganhtuan63,项目名称:go-microservices-example,代码行数:27,代码来源:repo.go


示例7: PutActivity

func PutActivity(db gorm.DB, router *gin.Engine) {
	// PUT /activity
	// Update activity data by id
	router.PUT("/activity/:id", func(c *gin.Context) {
		_id := c.Param("id")
		if id, err := strconv.ParseUint(_id, 10, 64); err == nil {
			var activityData model.ActivityData
			if err := c.BindJSON(&activityData); err == nil {
				activity := &model.Activity{
					ActivityData: activityData,
					ActivityId:   model.ActivityId{Id: id},
				}
				if err := checkDataActivity(activity.ActivityData); err {
					checkActivity := &model.Activity{
						ActivityData: activityData,
						ActivityId:   model.ActivityId{Id: id},
					}
					if err := db.First(checkActivity).Error; err == nil {
						db.Save(&activity)
						c.JSON(http.StatusOK, activity)
					} else {
						c.AbortWithStatus(http.StatusNotFound)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			}
		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:33,代码来源:activity.go


示例8: PutModuleEnabled

func PutModuleEnabled(db gorm.DB, router *gin.Engine) {
	// PUT /module_enabled
	// Update module_enabled data by id
	router.PUT("/module_enabled/:id", func(c *gin.Context) {
		_id := c.Param("id")
		if id, err := strconv.ParseUint(_id, 10, 64); err == nil {
			var module_enabledData model.ModuleEnabledData
			if err := c.BindJSON(&module_enabledData); err == nil {
				module_enabled := &model.ModuleEnabled{
					ModuleEnabledData: module_enabledData,
					ModuleEnabledId:   model.ModuleEnabledId{Id: id},
				}
				if err := checkDataModuleEnabled(module_enabled.ModuleEnabledData); err {
					checkModuleEnabled := &model.ModuleEnabled{
						ModuleEnabledData: module_enabledData,
						ModuleEnabledId:   model.ModuleEnabledId{Id: id},
					}
					if err := db.First(checkModuleEnabled).Error; err == nil {
						db.Save(&module_enabled)
						c.JSON(http.StatusOK, module_enabled)
					} else {
						c.AbortWithStatus(http.StatusNotFound)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			}
		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:33,代码来源:module_enabled.go


示例9: NewUserResource

func NewUserResource(e *gin.Engine) {
	u := UserResource{}

	// Setup Routes
	e.GET("/users", u.getAllUsers)
	e.GET("/users/:id", u.getUserByID)
}
开发者ID:sbecker,项目名称:gin-api-demo,代码行数:7,代码来源:user_resource.go


示例10: PutProfileFieldCategory

func PutProfileFieldCategory(db gorm.DB, router *gin.Engine) {
	// PUT /profile_field_category
	// Update profile_field_category data by id
	router.PUT("/profile_field_category/:id", func(c *gin.Context) {
		_id := c.Param("id")
		if id, err := strconv.ParseUint(_id, 10, 64); err == nil {
			var profile_field_categoryData model.ProfileFieldCategoryData
			if err := c.BindJSON(&profile_field_categoryData); err == nil {
				profile_field_category := &model.ProfileFieldCategory{
					ProfileFieldCategoryData: profile_field_categoryData,
					ProfileFieldCategoryId:   model.ProfileFieldCategoryId{Id: id},
				}
				if err := checkDataProfileFieldCategory(profile_field_category.ProfileFieldCategoryData); err {
					checkProfileFieldCategory := &model.ProfileFieldCategory{
						ProfileFieldCategoryData: profile_field_categoryData,
						ProfileFieldCategoryId:   model.ProfileFieldCategoryId{Id: id},
					}
					if err := db.First(checkProfileFieldCategory).Error; err == nil {
						db.Save(&profile_field_category)
						c.JSON(http.StatusOK, profile_field_category)
					} else {
						c.AbortWithStatus(http.StatusNotFound)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			}
		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:33,代码来源:profile_field_category.go


示例11: setupMiddleware

// setupMiddleware is an internal method where we setup GIN middleware
func setupMiddleware(r *gin.Engine) {
	// TODO: CACHE_URL should come from an environment variable but this requires
	// validating and parsing of the connection url into it's base components.
	store, err := sessions.NewRedisStore(10, "tcp", "localhost:6379", "", []byte(config.Config.Session_Secret))
	if err != nil {
		log.Fatalln("Failed to connect to Redis.", err)
	}

	r.Use(
		secure.Secure(secure.Options{ // TODO: we should get these from config
			AllowedHosts:          []string{},
			SSLRedirect:           false,
			SSLHost:               "",
			SSLProxyHeaders:       map[string]string{"X-Forwarded-Proto": "https"},
			STSSeconds:            315360000,
			STSIncludeSubdomains:  true,
			FrameDeny:             true,
			ContentTypeNosniff:    true,
			BrowserXssFilter:      true,
			ContentSecurityPolicy: "default-src 'self'",
		}),
		sessions.Sessions("session", store),
		auth.UserMiddleware(),
	)
}
开发者ID:robvdl,项目名称:gcms,代码行数:26,代码来源:web.go


示例12: PostProfileFieldCategory

func PostProfileFieldCategory(db gorm.DB, router *gin.Engine) {
	// POST /profile_field_category
	// POST new profile_field_category to database
	router.POST("/profile_field_category", func(c *gin.Context) {
		var profile_field_categoryData model.ProfileFieldCategoryData
		if err := c.BindJSON(&profile_field_categoryData); err == nil {
			profile_field_category := &model.ProfileFieldCategory{
				ProfileFieldCategoryData: profile_field_categoryData,
			}

			var x_user uint64
			if resp := c.Request.Header.Get(userHeader); resp != "" {
				conv_user, _ := strconv.ParseUint(resp, 10, 64)
				x_user = conv_user
				profile_field_category.Trace.CreatedBy = x_user
				profile_field_category.Trace.UpdatedBy = x_user
				if err := checkDataProfileFieldCategory(profile_field_category.ProfileFieldCategoryData); err {
					if err := db.Create(&profile_field_category).Error; err != nil {
						c.AbortWithError(http.StatusBadRequest, err)
					} else {
						c.JSON(http.StatusCreated, profile_field_category)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			} else {
				c.AbortWithStatus(http.StatusForbidden)
			}

		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:35,代码来源:profile_field_category.go


示例13: PutUrlOembed

func PutUrlOembed(db gorm.DB, router *gin.Engine) {
	// PUT /url_oembed
	// Update url_oembed data by id
	router.PUT("/url_oembed/:id", func(c *gin.Context) {
		_id := c.Param("id")
		if id, err := strconv.ParseUint(_id, 10, 64); err == nil {
			var url_oembedData model.UrlOembedData
			if err := c.BindJSON(&url_oembedData); err == nil {
				url_oembed := &model.UrlOembed{
					UrlOembedData: url_oembedData,
					UrlOembedId:   model.UrlOembedId{Id: id},
				}
				if err := checkDataUrlOembed(url_oembed.UrlOembedData); err {
					checkUrlOembed := &model.UrlOembed{
						UrlOembedData: url_oembedData,
						UrlOembedId:   model.UrlOembedId{Id: id},
					}
					if err := db.First(checkUrlOembed).Error; err == nil {
						db.Save(&url_oembed)
						c.JSON(http.StatusOK, url_oembed)
					} else {
						c.AbortWithStatus(http.StatusNotFound)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			}
		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:33,代码来源:url_oembed.go


示例14: InitRoutesTopics

// InitRoutesTopics initialized routes for Topics Controller
func InitRoutesTopics(router *gin.Engine) {
	topicsCtrl := &controllers.TopicsController{}

	g := router.Group("/")
	g.Use(CheckPassword())
	{
		g.GET("/topics", topicsCtrl.List)
		g.POST("/topic", topicsCtrl.Create)
		g.DELETE("/topic/*topic", topicsCtrl.Delete)
		g.GET("/topic/*topic", topicsCtrl.OneTopic)

		g.PUT("/topic/add/parameter", topicsCtrl.AddParameter)
		g.PUT("/topic/remove/parameter", topicsCtrl.RemoveParameter)

		g.PUT("/topic/add/rouser", topicsCtrl.AddRoUser)
		g.PUT("/topic/remove/rouser", topicsCtrl.RemoveRoUser)
		g.PUT("/topic/add/rwuser", topicsCtrl.AddRwUser)
		g.PUT("/topic/remove/rwuser", topicsCtrl.RemoveRwUser)
		g.PUT("/topic/add/adminuser", topicsCtrl.AddAdminUser)
		g.PUT("/topic/remove/adminuser", topicsCtrl.RemoveAdminUser)

		g.PUT("/topic/add/rogroup", topicsCtrl.AddRoGroup)
		g.PUT("/topic/remove/rogroup", topicsCtrl.RemoveRoGroup)
		g.PUT("/topic/add/rwgroup", topicsCtrl.AddRwGroup)
		g.PUT("/topic/remove/rwgroup", topicsCtrl.RemoveRwGroup)
		g.PUT("/topic/add/admingroup", topicsCtrl.AddAdminGroup)
		g.PUT("/topic/remove/admingroup", topicsCtrl.RemoveAdminGroup)
		g.PUT("/topic/param", topicsCtrl.SetParam)
	}
}
开发者ID:vmalguy,项目名称:tat,代码行数:31,代码来源:topics.go


示例15: PostNotification

func PostNotification(db gorm.DB, router *gin.Engine) {
	// POST /notification
	// POST new notification to database
	router.POST("/notification", func(c *gin.Context) {
		var notificationData model.NotificationData
		if err := c.BindJSON(&notificationData); err == nil {
			notification := &model.Notification{
				NotificationData: notificationData,
			}

			var x_user uint64
			if resp := c.Request.Header.Get(userHeader); resp != "" {
				conv_user, _ := strconv.ParseUint(resp, 10, 64)
				x_user = conv_user
				notification.Trace.CreatedBy = x_user
				notification.Trace.UpdatedBy = x_user
				if err := checkDataNotification(notification.NotificationData); err {
					if err := db.Create(&notification).Error; err != nil {
						c.AbortWithError(http.StatusBadRequest, err)
					} else {
						c.JSON(http.StatusCreated, notification)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			} else {
				c.AbortWithStatus(http.StatusForbidden)
			}

		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:35,代码来源:notification.go


示例16: Init

func Init(router *gin.Engine, DB *db.Session, fn func() gin.HandlerFunc) {
	// Simple group: v1
	api := &API{DB}
	v1 := router.Group("/v1")
	{
		v1.Use(fn())
		policies := v1.Group("policies")
		{
			policies.POST("/", api.createPolicy)
			policies.GET("/", api.getPolicies)
			policies.DELETE("/", api.deletePolicies)
			policies.DELETE("/:id", api.deletePolicy)
			policies.PUT("/:id", api.updatePolicy)
		}
		res := v1.Group("resources")
		{
			res.POST("/", api.createResource)
			res.GET("/:type", api.getResources)
			//res.GET("/:type/:id", api.getResources)
			res.DELETE("/", api.deleteResources)
			res.DELETE("/:id", api.deleteResource)
			res.PUT("/:id", api.updateResource)
		}
	}

}
开发者ID:gophergala2016,项目名称:ring_leader,代码行数:26,代码来源:api.go


示例17: PutNotification

func PutNotification(db gorm.DB, router *gin.Engine) {
	// PUT /notification
	// Update notification data by id
	router.PUT("/notification/:id", func(c *gin.Context) {
		_id := c.Param("id")
		if id, err := strconv.ParseUint(_id, 10, 64); err == nil {
			var notificationData model.NotificationData
			if err := c.BindJSON(&notificationData); err == nil {
				notification := &model.Notification{
					NotificationData: notificationData,
					NotificationId:   model.NotificationId{Id: id},
				}
				if err := checkDataNotification(notification.NotificationData); err {
					checkNotification := &model.Notification{
						NotificationData: notificationData,
						NotificationId:   model.NotificationId{Id: id},
					}
					if err := db.First(checkNotification).Error; err == nil {
						db.Save(&notification)
						c.JSON(http.StatusOK, notification)
					} else {
						c.AbortWithStatus(http.StatusNotFound)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			}
		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:33,代码来源:notification.go


示例18: PutContent

func PutContent(db gorm.DB, router *gin.Engine) {
	// PUT /content
	// Update content data by id
	router.PUT("/content/:id", func(c *gin.Context) {
		_id := c.Param("id")
		if id, err := strconv.ParseUint(_id, 10, 64); err == nil {
			var contentData model.ContentData
			if err := c.BindJSON(&contentData); err == nil {
				content := &model.Content{
					ContentData: contentData,
					ContentId:   model.ContentId{Id: id},
				}
				if err := checkDataContent(content.ContentData); err {
					checkContent := &model.Content{
						ContentData: contentData,
						ContentId:   model.ContentId{Id: id},
					}
					if err := db.First(checkContent).Error; err == nil {
						db.Save(&content)
						c.JSON(http.StatusOK, content)
					} else {
						c.AbortWithStatus(http.StatusNotFound)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			}
		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:33,代码来源:content.go


示例19: PostActivity

func PostActivity(db gorm.DB, router *gin.Engine) {
	// POST /activity
	// POST new activity to database
	router.POST("/activity", func(c *gin.Context) {
		var activityData model.ActivityData
		if err := c.BindJSON(&activityData); err == nil {
			activity := &model.Activity{
				ActivityData: activityData,
			}

			var x_user uint64
			if resp := c.Request.Header.Get(userHeader); resp != "" {
				conv_user, _ := strconv.ParseUint(resp, 10, 64)
				x_user = conv_user
				activity.Trace.CreatedBy = x_user
				activity.Trace.UpdatedBy = x_user
				if err := checkDataActivity(activity.ActivityData); err {
					if err := db.Create(&activity).Error; err != nil {
						c.AbortWithError(http.StatusBadRequest, err)
					} else {
						c.JSON(http.StatusCreated, activity)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			} else {
				c.AbortWithStatus(http.StatusForbidden)
			}

		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:35,代码来源:activity.go


示例20: PostSpaceSetting

func PostSpaceSetting(db gorm.DB, router *gin.Engine) {
	// POST /space_setting
	// POST new space_setting to database
	router.POST("/space_setting", func(c *gin.Context) {
		var space_settingData model.SpaceSettingData
		if err := c.BindJSON(&space_settingData); err == nil {
			space_setting := &model.SpaceSetting{
				SpaceSettingData: space_settingData,
			}

			var x_user uint64
			if resp := c.Request.Header.Get(userHeader); resp != "" {
				conv_user, _ := strconv.ParseUint(resp, 10, 64)
				x_user = conv_user
				space_setting.Trace.CreatedBy = x_user
				space_setting.Trace.UpdatedBy = x_user
				if err := checkDataSpaceSetting(space_setting.SpaceSettingData); err {
					if err := db.Create(&space_setting).Error; err != nil {
						c.AbortWithError(http.StatusBadRequest, err)
					} else {
						c.JSON(http.StatusCreated, space_setting)
					}
				} else {
					c.AbortWithStatus(http.StatusBadRequest)
				}
			} else {
				c.AbortWithStatus(http.StatusForbidden)
			}

		} else {
			log.Print(err)
			c.AbortWithError(http.StatusBadRequest, err)
		}
	})
}
开发者ID:ali-abdalla,项目名称:humhub-api,代码行数:35,代码来源:space_setting.go



注:本文中的github.com/gin-gonic/gin.Engine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang gin.RouterGroup类代码示例发布时间:2022-05-23
下一篇:
Golang gin.Context类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap