updateSession updates any parameter of a charging session and persists the session.
(opts ...sessionOption)
| 107 | |
| 108 | // updateSession updates any parameter of a charging session and persists the session. |
| 109 | func (lp *Loadpoint) updateSession(opts ...sessionOption) { |
| 110 | // test guard |
| 111 | if lp.db == nil || lp.session == nil { |
| 112 | return |
| 113 | } |
| 114 | |
| 115 | for _, opt := range opts { |
| 116 | opt(lp.session) |
| 117 | } |
| 118 | |
| 119 | if !lp.session.Created.IsZero() { |
| 120 | lp.db.Persist(lp.session) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | // clearSession clears the charging session without persisting it. |
| 125 | func (lp *Loadpoint) clearSession() { |