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


Golang Wrapper.Shift方法代碼示例

本文整理匯總了Golang中github.com/mongolar/mongolar/wrapper.Wrapper.Shift方法的典型用法代碼示例。如果您正苦於以下問題:Golang Wrapper.Shift方法的具體用法?Golang Wrapper.Shift怎麽用?Golang Wrapper.Shift使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/mongolar/mongolar/wrapper.Wrapper的用法示例。


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

示例1: AddExistingChild

// Controller for adding existing element to wrapper element or path.
func AddExistingChild(w *wrapper.Wrapper) {
	var parenttype string
	if len(w.APIParams) > 1 {
		parenttype = w.APIParams[0]
	} else {
		http.Error(w.Writer, "Forbidden", 403)
		w.Serve()
		return
	}
	if w.Request.Method != "POST" {
		AddExistingChildForm(w)
		return
	}
	w.Shift()
	switch parenttype {
	case "wrapper":
		AddExistingWrapperSubmit(w)
		return
	case "paths":
		AddExistingPathSubmit(w)
		return
	default:
		http.Error(w.Writer, "Forbidden", 403)
		w.Serve()
	}
	return
}
開發者ID:ultimatums,項目名稱:mongolar,代碼行數:28,代碼來源:children.go

示例2: Login

func (l *LoginMap) Login(w *wrapper.Wrapper) {
	if controller, ok := l.Controllers[w.APIParams[0]]; ok {
		w.Shift()
		controller(w)
		return
	}
	http.Error(w.Writer, "Forbidden", 403)
	return
}
開發者ID:bdatchar,項目名稱:mongolar,代碼行數:9,代碼來源:oauthlogin.go

示例3: Admin

//Main controller for all admin functions
func (a AdminMap) Admin(w *wrapper.Wrapper) {
	if c, ok := a[w.APIParams[0]]; ok {
		if validateAdmin(w) {
			w.Shift()
			c(w)
		}
		return
	} else {
		http.Error(w.Writer, "Forbidden", 403)
		return
	}
}
開發者ID:ultimatums,項目名稱:mongolar,代碼行數:13,代碼來源:admin.go

示例4: Admin

//Main controller for all admin functions
func (a AdminMap) Admin(w *wrapper.Wrapper) {
	w.Writer.Header().Add("Cache-Control", "no-cache, no-store, must-revalidate")
	w.Writer.Header().Add("Pragma", "no-cache")
	w.Writer.Header().Add("Expires", "0")
	if c, ok := a[w.APIParams[0]]; ok {
		if validateAdmin(w) {
			w.Shift()
			c(w)
		}
		return
	} else {
		http.Error(w.Writer, "Forbidden", 403)
		return
	}
}
開發者ID:bdatchar,項目名稱:mongolar,代碼行數:16,代碼來源:admin.go

示例5: AddChild

// Controller for adding children to wrapper element or path.
func AddChild(w *wrapper.Wrapper) {
	var parenttype string
	if len(w.APIParams) > 1 {
		parenttype = w.APIParams[0]
	} else {
		http.Error(w.Writer, "Forbidden", 403)
		w.Serve()
		return
	}
	w.Shift()
	switch parenttype {
	case "wrapper":
		AddWrapperChild(w)
	case "slug":
		AddSlugChild(w)
	case "paths":
		AddPathChild(w)
	default:
		http.Error(w.Writer, "Forbidden", 403)
		w.Serve()
	}
	return
}
開發者ID:ultimatums,項目名稱:mongolar,代碼行數:24,代碼來源:children.go

示例6: Delete

// This controller deletes paths and elements
func Delete(w *wrapper.Wrapper) {
	var parenttype string
	if len(w.APIParams) > 1 {
		parenttype = w.APIParams[0]
	} else {
		http.Error(w.Writer, "Forbidden", 403)
		w.Serve()
		return
	}
	w.Shift()
	switch parenttype {
	case "elements":
		DeleteElement(w)
		return
	case "paths":
		DeletePath(w)
		return
	default:
		http.Error(w.Writer, "Forbidden", 403)
		w.Serve()
	}
	return
}
開發者ID:bdatchar,項目名稱:mongolar,代碼行數:24,代碼來源:delete.go


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