add package gkvdb; add kvdb storage feature for ghttp.Server

This commit is contained in:
John
2019-08-22 21:04:30 +08:00
parent 51a156420d
commit 7dffd9d1ff
20 changed files with 795 additions and 113 deletions

View File

@ -172,6 +172,19 @@ func (v *Var) Interfaces() []interface{} {
return gconv.Interfaces(v.Val())
}
// Vars converts and returns <v> as []*Var.
func (v *Var) Vars() []*Var {
array := gconv.Interfaces(v.Val())
if len(array) == 0 {
return nil
}
vars := make([]*Var, len(array))
for k, v := range array {
vars[k] = New(v)
}
return vars
}
// Time converts and returns <v> as time.Time.
// The parameter <format> specifies the format of the time string using gtime,
// eg: Y-m-d H:i:s.