FindLogById finds a single Log entry by its id.
(id string)
| 14 | |
| 15 | // FindLogById finds a single Log entry by its id. |
| 16 | func (app *BaseApp) FindLogById(id string) (*Log, error) { |
| 17 | model := &Log{} |
| 18 | |
| 19 | err := app.LogQuery(). |
| 20 | AndWhere(dbx.HashExp{"id": id}). |
| 21 | Limit(1). |
| 22 | One(model) |
| 23 | |
| 24 | if err != nil { |
| 25 | return nil, err |
| 26 | } |
| 27 | |
| 28 | return model, nil |
| 29 | } |
| 30 | |
| 31 | // LogsStatsItem defines the total number of logs for a specific time period. |
| 32 | type LogsStatsItem struct { |