Documentation
¶
Index ¶
- func Register(h Handler, g *echo.Group)
- type BoltHandler
- func (b *BoltHandler) Browse(c echo.Context) error
- func (b *BoltHandler) Create(c echo.Context) error
- func (b *BoltHandler) Delete(c echo.Context) error
- func (b *BoltHandler) Modify(c echo.Context) error
- func (b *BoltHandler) Remove(c echo.Context) error
- func (b *BoltHandler) Select(c echo.Context) error
- func (b *BoltHandler) Update(c echo.Context) error
- type Handler
- type Marshalable
- type MarshalableModel
- func (m *MarshalableModel) Filter(v url.Values) bool
- func (m *MarshalableModel) MakeKey(n uint64) []byte
- func (m *MarshalableModel) Marshal() ([]byte, error)
- func (m *MarshalableModel) MarshalJSON() ([]byte, error)
- func (m *MarshalableModel) Merge(other MarshalableModel) error
- func (m *MarshalableModel) Unmarshal(data []byte) error
- func (m *MarshalableModel) UnmarshalJSON(data []byte) error
- func (m *MarshalableModel) Validate() error
- type Model
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoltHandler ¶
type BoltHandler struct {
// contains filtered or unexported fields
}
BoltHandler holds the data needed for a bolt backend handler
func NewBoltHandler ¶
func NewBoltHandler(db *bolt.DB, name []byte, instantiate func() MarshalableModel) (*BoltHandler, error)
NewBoltHandler creates a new BoltHandler instance
func (*BoltHandler) Browse ¶
func (b *BoltHandler) Browse(c echo.Context) error
Browse the list of items in the handler bucket
func (*BoltHandler) Create ¶
func (b *BoltHandler) Create(c echo.Context) error
Create an item in the handler bucket
func (*BoltHandler) Delete ¶
func (b *BoltHandler) Delete(c echo.Context) error
Delete the bucket (default not allowed)
func (*BoltHandler) Modify ¶
func (b *BoltHandler) Modify(c echo.Context) error
Modify a part of an item in the handler bucket
func (*BoltHandler) Remove ¶
func (b *BoltHandler) Remove(c echo.Context) error
Remove an item in the handler bucket
type Handler ¶
type Handler interface { Browse(echo.Context) error Create(echo.Context) error Delete(echo.Context) error Select(echo.Context) error Modify(echo.Context) error Update(echo.Context) error Remove(echo.Context) error }
Handler defines the REST endpoint handlers interface
type Marshalable ¶
type Marshalable interface { GetModel() Model SetModel(Model) Marshal() ([]byte, error) Unmarshal([]byte) error MarshalJSON() ([]byte, error) UnmarshalJSON([]byte) error }
Marshalable defines the interface required for Model marshalling
type MarshalableModel ¶
type MarshalableModel struct {
// contains filtered or unexported fields
}
MarshalableModel is the integrated type for Model and Marshalable
func NewJSONModel ¶
func NewJSONModel(model Model) MarshalableModel
NewJSONModel returns a new jsonMarshalable MarshalableModel
func (*MarshalableModel) Filter ¶
func (m *MarshalableModel) Filter(v url.Values) bool
Filter delegates the call to Marshalable.Model.Filter
func (*MarshalableModel) MakeKey ¶
func (m *MarshalableModel) MakeKey(n uint64) []byte
MakeKey delegates the call to Marshalable.Model.MakeKey
func (*MarshalableModel) Marshal ¶
func (m *MarshalableModel) Marshal() ([]byte, error)
Marshal delegates the call to Marshalable.Marshal
func (*MarshalableModel) MarshalJSON ¶
func (m *MarshalableModel) MarshalJSON() ([]byte, error)
MarshalJSON delegates the call to Marshalable.MarshalJSON
func (*MarshalableModel) Merge ¶
func (m *MarshalableModel) Merge(other MarshalableModel) error
Merge delegates the call to Marshalable.Model.Merge
func (*MarshalableModel) Unmarshal ¶
func (m *MarshalableModel) Unmarshal(data []byte) error
Unmarshal delegates the call to Marshalable.Unmarshal
func (*MarshalableModel) UnmarshalJSON ¶
func (m *MarshalableModel) UnmarshalJSON(data []byte) error
UnmarshalJSON delegates the call to Marshalable.UnmarshalJSON
func (*MarshalableModel) Validate ¶
func (m *MarshalableModel) Validate() error
Validate delegates the call to Marshalable.Model.Validate