(ctx *context.Context, listObj K8sListObj, keywords string)
| 200 | var timeTemplate = "2006-01-02T15:04:05Z" |
| 201 | |
| 202 | func pagerAndSearch(ctx *context.Context, listObj K8sListObj, keywords string) (*pkgV1.Page, error) { |
| 203 | num, err1 := ctx.Values().GetInt("pageNum") |
| 204 | size, err2 := ctx.Values().GetInt("pageSize") |
| 205 | var p pkgV1.Page |
| 206 | if listObj.Kind != "NodeList" { |
| 207 | listObj.Sort() |
| 208 | } |
| 209 | if keywords != "" { |
| 210 | listObj.Items = fieldFilter(listObj.Items, withNamespaceAndNameMatcher(keywords)) |
| 211 | } |
| 212 | if err1 == nil && err2 == nil { |
| 213 | tt, items, err := pageFilter(num, size, listObj.Items) |
| 214 | if err != nil { |
| 215 | return nil, err |
| 216 | } |
| 217 | listObj.Items = items |
| 218 | p.Total = tt |
| 219 | p.Items = listObj.Items |
| 220 | return &p, nil |
| 221 | } |
| 222 | p.Total = len(listObj.Items) |
| 223 | p.Items = listObj.Items |
| 224 | return &p, nil |
| 225 | } |
| 226 | |
| 227 | func getTime(obj interface{}) time.Time { |
| 228 | //判断是否存在lasttime |
no test coverage detected