Documentation ¶
Index ¶
- Variables
- func DecoderFromJSON(js json.RawMessage) (encoders.Decoder, error)
- func DeleterFromJSON(js json.RawMessage) (rw.Deleter, error)
- func EncoderDecoderFromString(str string) encoders.EncoderDecoder
- func EncoderFromJSON(js json.RawMessage) (encoders.Encoder, error)
- func GetElementType(js json.RawMessage) (string, error)
- func RWDFromString(str string) rw.ReadWriteDeleter
- func ReaderFromJSON(js json.RawMessage) (rw.Reader, error)
- func RouterFromConfig(config json.RawMessage, silent bool) *chi.Mux
- func SetDeleteHandler(r chi.Router, del rw.Deleter)
- func SetHandler(r *chi.Mux, d Definition)
- func SetReadHandler(r chi.Router, ops *ReadOperations)
- func SetWriteHandler(r chi.Router, ops *WriteOperations)
- func UnmarshalAndStart(s Startable, js json.RawMessage) error
- func WriterFromJSON(js json.RawMessage) (rw.Writer, error)
- type Definition
- type ReadOperations
- type Startable
- type WriteOperations
- type WriteResponse
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknowElementType is returned if an element does not implement a valid type. ErrUnknowElementType = errors.New("unknow element does not implement a valid type") )
Functions ¶
func DecoderFromJSON ¶
func DecoderFromJSON(js json.RawMessage) (encoders.Decoder, error)
DecoderFromJSON builds a decoder from json.
func DeleterFromJSON ¶
func DeleterFromJSON(js json.RawMessage) (rw.Deleter, error)
DeleterFromJSON builds a deleter from json.
func EncoderDecoderFromString ¶
func EncoderDecoderFromString(str string) encoders.EncoderDecoder
EncoderDecoderFromString returns an encoders.EncoderDecoder from it's name.
func EncoderFromJSON ¶
func EncoderFromJSON(js json.RawMessage) (encoders.Encoder, error)
EncoderFromJSON builds an encoder from json.
func GetElementType ¶
func GetElementType(js json.RawMessage) (string, error)
GetElementType return a string representing the element type.
func RWDFromString ¶
func RWDFromString(str string) rw.ReadWriteDeleter
RWDFromString returns a rw.ReadWriteDeleter from it's name.
func ReaderFromJSON ¶
func ReaderFromJSON(js json.RawMessage) (rw.Reader, error)
ReaderFromJSON builds a reader from json.
func RouterFromConfig ¶
func RouterFromConfig(config json.RawMessage, silent bool) *chi.Mux
RouterFromConfig setup a chi.Mux router from a json configuration.
func SetDeleteHandler ¶
SetDeleteHandler sets a chi handler for a Deleter.
func SetHandler ¶
func SetHandler(r *chi.Mux, d Definition)
SetHandler set the right handler in chi for the provoded ServiceDefinition.
func SetReadHandler ¶
func SetReadHandler(r chi.Router, ops *ReadOperations)
SetReadHandler sets a chi handler for a Reader.
func SetWriteHandler ¶
func SetWriteHandler(r chi.Router, ops *WriteOperations)
SetWriteHandler sets a chi router for a Writer.
func UnmarshalAndStart ¶
func UnmarshalAndStart(s Startable, js json.RawMessage) error
UnmarshalAndStart unmarshals a Startable element and start it.
func WriterFromJSON ¶
func WriterFromJSON(js json.RawMessage) (rw.Writer, error)
WriterFromJSON builds a writer from json.
Types ¶
type Definition ¶
type Definition struct { URL string `json:"url"` WriterPipe json.RawMessage `json:"writer,omitempty"` ReaderPipe json.RawMessage `json:"reader,omitempty"` Deleter json.RawMessage `json:"deleter,omitempty"` }
Definition defines a URL enpoint and at lease a either a Writer, a Reader or a Deleter.
func (*Definition) Error ¶
func (d *Definition) Error(err error)
Error display the service url and the encountred error.
type ReadOperations ¶
ReadOperations represents the various steps and the input necessary to retrieve data.
func NewReadOperationsFromJSON ¶
func NewReadOperationsFromJSON(js json.RawMessage) (*ReadOperations, error)
NewReadOperationsFromJSON builds a ReadOperations from json.
func (*ReadOperations) AddStep ¶
func (ro *ReadOperations) AddStep(js json.RawMessage) error
AddStep add a step to a ReadOperations from a json.RawMessage.
type Startable ¶
type Startable interface {
Start() error
}
Startable is an object that implements a Start() method. It'is used to start encoders and rws.
type WriteOperations ¶
WriteOperations represents the various steps and the output necessary to write data.
func NewTeeFromJSON ¶
func NewTeeFromJSON(js json.RawMessage) (*WriteOperations, error)
NewTeeFromJSON build a WriteOperations for a tee from json.
func NewWriteOperationsFromJSON ¶
func NewWriteOperationsFromJSON(js json.RawMessage) (*WriteOperations, error)
NewWriteOperationsFromJSON builds a WriteOperations from json.
func (*WriteOperations) AddStep ¶
func (wo *WriteOperations) AddStep(js json.RawMessage) error
AddStep add a step to a WriteOperations from a json.RawMessage.
type WriteResponse ¶
type WriteResponse struct { ID string `json:"id"` BytesIn int64 `json:"bytes_in"` BytesOut int64 `json:"bytes_out"` }
WriteResponse is returned as a json response on a sucessfull write.