github.com/rpdict/ponzu@v0.10.1-0.20190226054626-477f29d6bf5e/system/item/types.go (about) 1 package item 2 3 import "errors" 4 5 const ( 6 typeNotRegistered = `Error: 7 There is no type registered for %[1]s 8 9 Add this to the file which defines %[1]s{} in the 'content' package: 10 11 12 func init() { 13 item.Types["%[1]s"] = func() interface{} { return new(%[1]s) } 14 } 15 16 17 ` 18 ) 19 20 var ( 21 // ErrTypeNotRegistered means content type isn't registered (not found in Types map) 22 ErrTypeNotRegistered = errors.New(typeNotRegistered) 23 24 // ErrAllowHiddenItem should be used as an error to tell a caller of Hideable#Hide 25 // that this type is hidden, but should be shown in a particular case, i.e. 26 // if requested by a valid admin or user 27 ErrAllowHiddenItem = errors.New(`Allow hidden item`) 28 29 // Types is a map used to reference a type name to its actual Editable type 30 // mainly for lookups in /admin route based utilities 31 Types map[string]func() interface{} 32 ) 33 34 func init() { 35 Types = make(map[string]func() interface{}) 36 }