Documentation ¶
Index ¶
- Variables
- type Actions
- type Arg
- type Kind
- type Op
- type Registry
- func (r *Registry) Create(kind Kind, args ...Arg) (Arg, error)
- func (r *Registry) Delete(kind Kind, args ...Arg) (Arg, error)
- func (r *Registry) Do(kind Kind, op Op, args ...Arg) (Arg, error)
- func (r *Registry) Get(kind Kind) (Actions, error)
- func (r *Registry) Register(kind Kind, a Actions) error
- func (r *Registry) Update(kind Kind, args ...Arg) (Arg, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Create is a constant representing create operations. Create = Op{"Create"} // Update is a constant representing update operations. Update = Op{"Update"} // Delete is a constant representing delete operations. Delete = Op{"Delete"} )
Functions ¶
This section is empty.
Types ¶
type Actions ¶
type Actions interface { Create(...Arg) (Arg, error) Delete(...Arg) (Arg, error) Update(...Arg) (Arg, error) }
Actions is an interface for CRUD operations on any entity
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry can hold Kinds and their respective CRUD operations.
func (*Registry) Create ¶
Create calls the registered create action of kind with args and returns the result and error (if any).
func (*Registry) Delete ¶
Delete calls the registered delete action of kind with args and returns the result and error (if any).
func (*Registry) Get ¶
Get returns actions associated with kind. An error will be returned if kind was never registered.
Click to show internal directories.
Click to hide internal directories.