Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Description ¶
Description gives the name and available versions in a registry.
type TypedNameVersion ¶
type TypedNameVersion struct {
// contains filtered or unexported fields
}
TypedNameVersion is a registry that will allow you to register objects based on a name and version pair. The objects must be convertible to the Type defined when the registry was created. It will be cast during Register so you can be sure all objects returned from Get() are safe to TypeAssert to that type.
func NewTypedNameVersion ¶
func NewTypedNameVersion(requiredType reflect.Type) *TypedNameVersion
NewTypedNameVersion creates a place to register your objects
func (*TypedNameVersion) Get ¶
func (r *TypedNameVersion) Get(name string, version int) (interface{}, error)
Get returns the object for a single name and version. If the requested facade is not found, it returns error.NotFound
func (*TypedNameVersion) List ¶
func (r *TypedNameVersion) List() []Description
List returns a slice describing each of the registered Facades.
func (*TypedNameVersion) Register ¶
func (r *TypedNameVersion) Register(name string, version int, obj interface{}) error
Register records the factory that can be used to produce an instance of the facade at the supplied version. If the object being registered doesn't Implement the required Type, then an error is returned. An error is also returned if an object is already registered with the given name and version.