messages

package
v0.0.0-...-4ee5816 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DEBUG ...
	DEBUG int = iota + 1
	// INFO ...
	INFO
	// SUCCESS ...
	SUCCESS
	// WARNING ...
	WARNING
	// ERROR ...
	ERROR
)

Shut up golint

Variables

View Source
var UserSessionKey string = "gobwebs.UserSession"

UserSessionKey session key to store User object

Functions

func Add

func Add(c echo.Context, level int, msg string)

Add adds a message to the messate store

func Clear

func Clear(c echo.Context)

Clear clears all messages

func Debug

func Debug(c echo.Context, msg string)

Debug helper function

func Error

func Error(c echo.Context, msg string)

Error helper function

func Info

func Info(c echo.Context, msg string)

Info helper function

func SaveStore

func SaveStore(c echo.Context, ms *WebMessageStore)

SaveStore saves messages store in session

func Success

func Success(c echo.Context, msg string)

Success helper function

func Warning

func Warning(c echo.Context, msg string)

Warning helper function

Types

type WebMessage

type WebMessage struct {
	Level   int // 1 debug, 2 info, 3 success, 4 warn, 5 error
	Message string
}

WebMessage is a message to display to a user

func GetAll

func GetAll(c echo.Context) []*WebMessage

GetAll gets all messages in session

type WebMessageStore

type WebMessageStore struct {
	Messages []*WebMessage
	// contains filtered or unexported fields
}

WebMessageStore is the wrapper for messages

func LoadStore

func LoadStore(c echo.Context) *WebMessageStore

LoadStore loads the session message store

func (*WebMessageStore) Add

func (w *WebMessageStore) Add(m *WebMessage)

Add adds a message

func (*WebMessageStore) Clear

func (w *WebMessageStore) Clear(lock bool)

Clear clears out all messages

func (*WebMessageStore) GetAll

func (w *WebMessageStore) GetAll() []*WebMessage

GetAll returns all messages, clears messages after

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL