本文整理匯總了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
}
示例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
}
示例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
}
}
示例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
}
}
示例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
}
示例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
}