Flashes returns a slice of flash messages from 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.
(vars ...string)
| 45 | // A single variadic argument is accepted, and it is optional: it defines |
| 46 | // the flash key. If not defined "_flash" is used by default. |
| 47 | func (s *Session) Flashes(vars ...string) []interface{} { |
| 48 | var flashes []interface{} |
| 49 | key := flashesKey |
| 50 | if len(vars) > 0 { |
| 51 | key = vars[0] |
| 52 | } |
| 53 | if v, ok := s.Values[key]; ok { |
| 54 | // Drop the flashes and return it. |
| 55 | delete(s.Values, key) |
| 56 | flashes = v.([]interface{}) |
| 57 | } |
| 58 | return flashes |
| 59 | } |
| 60 | |
| 61 | // AddFlash adds a flash message to the session. |
| 62 | // |