Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( // PriorityHigh is high priority PriorityHigh Priority = 10 // PriorityNormal is normal priority PriorityNormal = 0 // PriorityLow is low priority PriorityLow = -10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Summary string `json:"summary"` Messages map[string][]Message `json:"messages,omitempty"` MaxPriority Priority `json:"-"` Total int `json:"-"` }
Error ...
func (*Error) Format ¶
Format ...
Example ¶
package main import ( "fmt" "github.com/podhmo/maperr" ) func main() { var err *maperr.Error err = err. AddSummary("💣error is occured"). Add("name", maperr.Message{Text: "name is empty"}) fmt.Printf("%v\n", err) fmt.Printf("%+v\n", err) }
Output: Error -- "💣error is occured" (1 number of errors) Error -- { "summary": "💣error is occured", "messages": { "name": [ { "text": "name is empty" } ] } }
func (*Error) MarshalJSON ¶ added in v0.1.0
MarshalJSON ...
type FlattenLayout ¶ added in v0.1.0
type FlattenLayout struct { Summary string `json:"summary"` Messages map[string][]Message `json:"messages,omitempty"` MaxPriority Priority `json:"-"` Total int `json:"-"` }
FlattenLayout ...
func (*FlattenLayout) Layout ¶ added in v0.1.0
func (v *FlattenLayout) Layout(err *Error) interface{}
Layout ...
type FullLayout ¶ added in v0.1.0
type FullLayout struct { Summary string `json:"summary"` Messages map[string][]Message `json:"messages,omitempty"` MaxPriority Priority `json:"-"` Total int `json:"-"` }
FullLayout ...
func (*FullLayout) Layout ¶ added in v0.1.0
func (v *FullLayout) Layout(err *Error) interface{}
Layout ...
type Layout ¶ added in v0.1.0
type Layout interface {
Layout(*Error) interface{}
}
Layout ...
var DefaultLayout Layout
Click to show internal directories.
Click to hide internal directories.