msg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERROR = 100
	WARN  = 200
	INFO  = 300
	TITLE = 900
	UNDEF = 500

	ErrValidationFailed        = 400
	ErrEntryPointUndefined     = 401
	ErrInvalidEntryPointReturn = 402
	ErrUndefinedView           = 403
	ErrInvalidReturn           = 404
	ErrMissingReqField         = 405
	ErrExcessAttr              = 406
	ErrInvalidOption           = 407
	ErrInvalidUnary            = 408
	ErrRedefined               = 409
	ErrBasePathInvalid         = 410

	WarnValidatedWithWarn = 300
	WarnValidationSkipped = 301

	InfoValidatedSuccessfully = 200
	TitleViewName             = 999
)

Variables

View Source
var (
	Messages = map[int]string{
		ErrValidationFailed:        "Validation failed",
		ErrEntryPointUndefined:     "Entry point view: (%s) is undefined",
		ErrInvalidEntryPointReturn: "Return type of entry point view: (%s) should be (%s)",
		ErrUndefinedView:           "View (%s) is undefined",
		ErrInvalidReturn:           "In view (%s), return type is invalid. (%s)",
		ErrMissingReqField:         "Missing required field (%s) in View (%s) with return Type (%s)",
		ErrExcessAttr:              "Excess Attribute (%s), defined in View (%s), having return Type (%s)",
		ErrInvalidOption:           "In View %s, (%s) does not match any of the options for return Type (%s)",
		ErrInvalidUnary:            "In view (%s), unary operator used with invalid type: (%s)",
		ErrRedefined:               "In view (%s), (%s) is already defined",

		WarnValidatedWithWarn: "Validated with warnings",
		WarnValidationSkipped: "Validation skipped. Reason: %s",

		InfoValidatedSuccessfully: "Validation success",

		TitleViewName: "Error in %s",
	}

	MessageType = map[int]int{
		ErrValidationFailed:        ERROR,
		ErrEntryPointUndefined:     ERROR,
		ErrInvalidEntryPointReturn: ERROR,
		ErrUndefinedView:           ERROR,
		ErrInvalidReturn:           ERROR,
		ErrMissingReqField:         ERROR,
		ErrExcessAttr:              ERROR,
		ErrInvalidOption:           ERROR,
		ErrInvalidUnary:            ERROR,
		ErrRedefined:               ERROR,

		WarnValidatedWithWarn: WARN,
		WarnValidationSkipped: WARN,

		InfoValidatedSuccessfully: INFO,
		TitleViewName:             TITLE,
	}
)

nolint:gochecknoglobals

Functions

This section is empty.

Types

type LogMessage

type LogMessage struct {
	Message string `json:"message"`
	MsgType int    `json:"msg_type"`
}

LogMessage holds message string and type of message

type Msg

type Msg struct {
	MessageID   int      `json:"message_id"`
	MessageData []string `json:"message_data"`
}

Msg holds message id and params to generate message string

func NewMsg

func NewMsg(messageID int, messageData []string) *Msg

func (Msg) LogMsg

func (m Msg) LogMsg()

LogMsg prints the message using logrus

func (Msg) String

func (m Msg) String() string

Jump to

Keyboard shortcuts

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