response

package
v0.0.0-...-d814896 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(code int, messageID string, messageArgs ...interface{}) error

NewError Creates a new internal function error

Types

type Error

type Error struct {
	Code        int
	MessageID   string
	MessageArgs []interface{}
}

Error defines a internal function error

func (*Error) Error

func (e *Error) Error() string

Error returns the error description

func (*Error) Message

func (e *Error) Message() *Message

Message returns a message which can be translated

type ExecResult

type ExecResult struct {
	Result      interface{}
	MessageID   string
	MessageArgs []interface{}
}

ExecResult defines an internal function result

func (*ExecResult) Data

func (e *ExecResult) Data() interface{}

Data implements the Result interface

func (*ExecResult) Message

func (e *ExecResult) Message() *Message

Message returns a message which can be translated

type JSONMessage

type JSONMessage struct {
	Message string `json:"message"`
}

JSONMessage defines a translated JSONMessage

type Message

type Message struct {
	MessageID   string        `json:"messagId"`
	MessageArgs []interface{} `json:"messageArgs"`
}

Message defines a translatable response message for the caller

func (*Message) AsTranslatedJSONMessage

func (m *Message) AsTranslatedJSONMessage(translator localization.Translator) JSONMessage

AsTranslatedJSONMessage translates the message and returns a json message which can be sent to user

type Result

type Result interface {
	Data() interface{}
	Message() *Message
}

Result Defines a internal function result

Jump to

Keyboard shortcuts

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