messages

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MessagesKey = "nyaapantsu.messages"

MessagesKey : use for context

Variables

This section is empty.

Functions

This section is empty.

Types

type Messages

type Messages struct {
	Errors map[string][]string
	Infos  map[string][]string

	T i18n.TranslateFunc
	// contains filtered or unexported fields
}

Messages struct

func GetMessages

func GetMessages(c *gin.Context) *Messages

GetMessages : Initialize or return the messages object from context

func (*Messages) AddError

func (mes *Messages) AddError(name string, msg string) error

AddError : Add an error in category name with message msg

func (*Messages) AddErrorT

func (mes *Messages) AddErrorT(name string, id string) error

AddErrorT : Add an error in category name with translation string id

func (*Messages) AddErrorTf

func (mes *Messages) AddErrorTf(name string, id string, args ...interface{}) error

AddErrorTf : Add an error in category name with translation string id formatted with args

func (*Messages) AddErrorf

func (mes *Messages) AddErrorf(name string, msg string, args ...interface{}) error

AddErrorf : Add an error in category name with message msg formatted with args

func (*Messages) AddInfo

func (mes *Messages) AddInfo(name string, msg string)

AddInfo : Add an info in category name with message msg

func (*Messages) AddInfoT

func (mes *Messages) AddInfoT(name string, id string)

AddInfoT : Add an info in category name with translation string id

func (*Messages) AddInfoTf

func (mes *Messages) AddInfoTf(name string, id string, args ...interface{})

AddInfoTf : Add an info in category name with translation string id formatted with args

func (*Messages) AddInfof

func (mes *Messages) AddInfof(name string, msg string, args ...interface{})

AddInfof : Add an info in category name with message msg formatted with args

func (*Messages) ClearAllErrors

func (mes *Messages) ClearAllErrors()

ClearAllErrors : Erase all errors in messages

func (*Messages) ClearAllInfos

func (mes *Messages) ClearAllInfos()

ClearAllInfos : Erase all infos in messages

func (*Messages) ClearErrors

func (mes *Messages) ClearErrors(name string)

ClearErrors : Erase all errors in messages

func (*Messages) ClearInfos

func (mes *Messages) ClearInfos(name string)

ClearInfos : Erase all infos in messages

func (*Messages) Error

func (mes *Messages) Error(err error) error

ImportFromError : Aliases to import directly an error in "errors" map index

func (*Messages) ErrorT

func (mes *Messages) ErrorT(err error) error

ErrorT : Aliases to import directly an error in "errors" map index and translate the error

func (*Messages) ErrorTf

func (mes *Messages) ErrorTf(err error, args ...interface{}) error

ErrorTf : Aliases to import directly an error in "errors" map index and translate the error with args

func (*Messages) GetAllErrors

func (mes *Messages) GetAllErrors() map[string][]string

GetAllErrors : Get all errors

func (*Messages) GetAllInfos

func (mes *Messages) GetAllInfos() map[string][]string

GetAllInfos : Get all infos

func (*Messages) GetErrors

func (mes *Messages) GetErrors(name string) []string

GetErrors : Get all errors in category name

func (*Messages) GetInfos

func (mes *Messages) GetInfos(name string) []string

GetInfos : Get all infos in category name

func (*Messages) HasErrors

func (mes *Messages) HasErrors() bool

HasErrors : Check if there are errors

func (*Messages) HasInfos

func (mes *Messages) HasInfos() bool

HasInfos : Check if there are infos

func (*Messages) ImportFromError

func (mes *Messages) ImportFromError(name string, err error) error

ImportFromError : Add an error in category name with message msg imported from type error

func (*Messages) ImportFromErrorT

func (mes *Messages) ImportFromErrorT(name string, err error) error

ImportFromErrorT : Add an error in category name with message msg imported from type error

func (*Messages) ImportFromErrorTf

func (mes *Messages) ImportFromErrorTf(name string, err error, args ...interface{}) error

ImportFromErrorTf : Add an error in category name with message msg imported from type error

Jump to

Keyboard shortcuts

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