本文整理汇总了Golang中github.com/Centny/Cny4go/routing.HTTPSession.ValidCheckVal方法的典型用法代码示例。如果您正苦于以下问题:Golang HTTPSession.ValidCheckVal方法的具体用法?Golang HTTPSession.ValidCheckVal怎么用?Golang HTTPSession.ValidCheckVal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Centny/Cny4go/routing.HTTPSession
的用法示例。
在下文中一共展示了HTTPSession.ValidCheckVal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: AddA
func AddA(hs *routing.HTTPSession) routing.HResult {
var key string
var val string
err := hs.ValidCheckVal(`
key,R|S,L:0;
val,R|S,L:0;
`, &key, &val)
if err != nil {
hs.W.Write([]byte(`
{
"code":1,
"msg":"error"
}
`))
return routing.HRES_RETURN
}
Vars[key] = val
hs.W.Write([]byte(`
{
"code":0,
"data":""
}
`))
return routing.HRES_RETURN
}
示例2: GetB
func GetB(hs *routing.HTTPSession) routing.HResult {
var key string
err := hs.ValidCheckVal(`
key,R|S,L:0;
`, &key)
if err != nil {
hs.W.Write([]byte(`
{
"code":1,
"msg":"error"
}
`))
return routing.HRES_RETURN
}
if v, ok := Vars[key]; ok {
hs.W.Write([]byte(fmt.Sprintf(`
{
"code":0,
"data":"%v"
}
`, v)))
} else {
hs.W.Write([]byte(`
{
"code":1,
"msg":"key not found"
}
`))
}
return routing.HRES_RETURN
}
示例3: DelA
func DelA(hs *routing.HTTPSession) routing.HResult {
var key string
err := hs.ValidCheckVal(`
key,R|S,L:0;
`, &key)
if err != nil {
hs.W.Write([]byte(`
{
"code":1,
"msg":"error"
}
`))
return routing.HRES_RETURN
}
if _, ok := Vars[key]; ok {
delete(Vars, key)
hs.W.Write([]byte(`
{
"code":0,
"data":""
}
`))
} else {
hs.W.Write([]byte(`
{
"code":1,
"msg":"key not found"
}
`))
}
return routing.HRES_RETURN
}
示例4: AddB
func AddB(hs *routing.HTTPSession) routing.HResult {
var key string
var val string
err := hs.ValidCheckVal(`
key,R|S,L:0;
val,R|S,L:0;
`, &key, &val)
if err != nil {
hs.W.Write([]byte(`
{
"code":1,
"msg":"error"
}
`))
return routing.HRES_RETURN
}
if _, ok := pkga.Vars[key]; ok {
Vars[key] = val
hs.W.Write([]byte(`
{
"code":0,
"data":""
}
`))
} else {
hs.W.Write([]byte(`
{
"code":1,
"msg":"key not found"
}
`))
}
return routing.HRES_RETURN
}