AddFlash adds a flash message to the session. A single variadic argument is accepted, and it is optional: it defines the flash key. If not defined "_flash" is used by default.
(value interface{}, vars ...string)
| 63 | // A single variadic argument is accepted, and it is optional: it defines |
| 64 | // the flash key. If not defined "_flash" is used by default. |
| 65 | func (s *Session) AddFlash(value interface{}, vars ...string) { |
| 66 | key := flashesKey |
| 67 | if len(vars) > 0 { |
| 68 | key = vars[0] |
| 69 | } |
| 70 | var flashes []interface{} |
| 71 | if v, ok := s.Values[key]; ok { |
| 72 | flashes = v.([]interface{}) |
| 73 | } |
| 74 | s.Values[key] = append(flashes, value) |
| 75 | } |
| 76 | |
| 77 | // Save is a convenience method to save this session. It is the same as calling |
| 78 | // store.Save(request, response, session). You should call Save before writing to |