| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package main | 5 package main |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bufio" | 8 "bufio" |
| 9 "encoding/json" | 9 "encoding/json" |
| 10 "io" | 10 "io" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 Updated clockflag.Time `json:"updated,omitempty"` | 215 Updated clockflag.Time `json:"updated,omitempty"` |
| 216 TerminalIndex int64 `json:"terminalIndex"` | 216 TerminalIndex int64 `json:"terminalIndex"` |
| 217 ArchiveIndexURL string `json:"archiveIndexUrl,omitempty
"` | 217 ArchiveIndexURL string `json:"archiveIndexUrl,omitempty
"` |
| 218 ArchiveStreamURL string `json:"archiveStreamUrl,omitempt
y"` | 218 ArchiveStreamURL string `json:"archiveStreamUrl,omitempt
y"` |
| 219 ArchiveDataURL string `json:"archiveDataUrl,omitempty"
` | 219 ArchiveDataURL string `json:"archiveDataUrl,omitempty"
` |
| 220 Purged bool `json:"purged,omitempty"` | 220 Purged bool `json:"purged,omitempty"` |
| 221 }{ | 221 }{ |
| 222 Project: string(s.Project), | 222 Project: string(s.Project), |
| 223 Path: string(s.Path), | 223 Path: string(s.Path), |
| 224 } | 224 } |
| 225 » if s.State != nil { | 225 » o.Created = clockflag.Time(s.State.Created) |
| 226 » » o.Created = clockflag.Time(s.State.Created) | 226 » o.Updated = clockflag.Time(s.State.Updated) |
| 227 » » o.Updated = clockflag.Time(s.State.Updated) | 227 » o.TerminalIndex = int64(s.State.TerminalIndex) |
| 228 » » o.TerminalIndex = int64(s.State.TerminalIndex) | 228 » o.ArchiveIndexURL = s.State.ArchiveIndexURL |
| 229 » » o.ArchiveIndexURL = s.State.ArchiveIndexURL | 229 » o.ArchiveStreamURL = s.State.ArchiveStreamURL |
| 230 » » o.ArchiveStreamURL = s.State.ArchiveStreamURL | 230 » o.ArchiveDataURL = s.State.ArchiveDataURL |
| 231 » » o.ArchiveDataURL = s.State.ArchiveDataURL | 231 » o.Purged = s.State.Purged |
| 232 » » o.Purged = s.State.Purged | 232 » o.Descriptor = &s.Desc |
| 233 » » o.Descriptor = s.Desc | |
| 234 » } | |
| 235 | 233 |
| 236 if p.enc == nil { | 234 if p.enc == nil { |
| 237 p.enc = json.NewEncoder(p) | 235 p.enc = json.NewEncoder(p) |
| 238 } | 236 } |
| 239 if err := p.enc.Encode(&o); err != nil { | 237 if err := p.enc.Encode(&o); err != nil { |
| 240 return err | 238 return err |
| 241 } | 239 } |
| 242 | 240 |
| 243 return p.Flush() | 241 return p.Flush() |
| 244 } | 242 } |
| 245 | 243 |
| 246 func (p *jsonQueryOutput) ensureStart() error { | 244 func (p *jsonQueryOutput) ensureStart() error { |
| 247 if p.count > 0 { | 245 if p.count > 0 { |
| 248 return nil | 246 return nil |
| 249 } | 247 } |
| 250 _, err := p.WriteString("[\n") | 248 _, err := p.WriteString("[\n") |
| 251 return err | 249 return err |
| 252 } | 250 } |
| 253 | 251 |
| 254 func (p *jsonQueryOutput) end() error { | 252 func (p *jsonQueryOutput) end() error { |
| 255 if err := p.ensureStart(); err != nil { | 253 if err := p.ensureStart(); err != nil { |
| 256 return err | 254 return err |
| 257 } | 255 } |
| 258 | 256 |
| 259 _, err := p.WriteRune(']') | 257 _, err := p.WriteRune(']') |
| 260 return err | 258 return err |
| 261 } | 259 } |
| OLD | NEW |