Documentation ¶
Overview ¶
Package config contains configuration-related code for Pullcord
Index ¶
Constants ¶
const ReferenceResourceTypeName = "ref"
ReferenceResourceTypeName is the reserved name to indicate a placeholder for an already registered resource instead of giving the type for for a new resource being defined.
const UnexpectedResourceType = errors.New(
"The requested resource does not have the expected type",
)
UnexpectedResourceType indicates that a sub-resource did not have an expected type.
Variables ¶
This section is empty.
Functions ¶
func MustRegisterResourceType ¶
func MustRegisterResourceType( typeName string, newFunc func() json.Unmarshaler, )
MustRegisterResourceType is a convenience function around RegisterResourceType that panics on error.
func RegisterResourceType ¶
func RegisterResourceType( typeName string, newFunc func() json.Unmarshaler, ) error
RegisterResourceType is an infrastructure hack that allows new config Resource types to be specified at run-time. It needs to be run before a Parser is used, presumably in an Init function of the package of a config plugin.
Types ¶
type HTTPMultiServer ¶
HTTPMultiServer implements the Pullcord server interface with an HTTP handler and multiple listeners.
func (*HTTPMultiServer) Close ¶
func (s *HTTPMultiServer) Close() error
Close implements .../pullcord/Server.
func (*HTTPMultiServer) Serve ¶
func (s *HTTPMultiServer) Serve() error
Serve implements .../pullcord/Server.
func (*HTTPMultiServer) UnmarshalJSON ¶
func (s *HTTPMultiServer) UnmarshalJSON(d []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.
type HTTPServer ¶
HTTPServer implements the Pullcord server interface with an HTTP handler.
func (*HTTPServer) UnmarshalJSON ¶
func (s *HTTPServer) UnmarshalJSON(d []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.
type Resource ¶
type Resource struct { Unmarshalled json.Unmarshaler // contains filtered or unexported fields }
Resource represents a configurable object which allows an arbitrary JSON blob to be turned into an implementation of whatever type it specifies. This abstraction is the key to allowing instantiation of structs which have interface members instead of just non-abstracted data types.
func (*Resource) UnmarshalJSON ¶
UnmarshalJSON implements encoding/json.Unmarshaler, which is the core requirement which allows these resources to be instantiated at all.