Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BCallback ¶
type BCallback struct {
Callback func()
}
BCallback calls the callback, nothing more. Useful for regression testing.
type BRecv ¶
type BRecv struct {
// Re is required, it's the regular expression to use for matching
Re *regexp.Regexp
// OnSuccess is optional, the first element is the entire matched pattern,
// the subsequent elements are submatches. Returning an error from here will
// stop the Batch operation and return with an error
OnSuccess func(matched []string) error
OnSuccessInject func(matched []string) ([]Batcher, error)
}
BRecv allows regexps to be matched on input
type BSend ¶
type BSend struct {
// Data stores the string to be sent over the connection
Data string
// OnSuccess is optional, returning an error from here will
// stop the Batch operation and return with an error
OnSuccess func() error
}
BSend sends data through the net.Conn interface
type BSendDyn ¶
type BSendDyn struct {
Data func() string // Data is required, the result is treated like BSend.Data
OnSuccess func() error // OnSuccess is like BSend.OnSuccess, it is optional
}
BSendDyn is like BSend however it determines what will be sent by calling the Data() callback
type BSwitch ¶
type BSwitch []*BSwitchOption
BSwitch allows regexps to be matched on input, and provide different execution paths depending on the matches
type BSwitchOption ¶
type BSwitchOption struct {
// BRecv
BRecv
// Child contains the actions to be run if the Re matches
Child []Batcher
}
BSwitchOption holds each possibility stored in a BSwitch
type BWipeBuf ¶
type BWipeBuf struct{}
BWipeBuf flushes any cached inbound data. You probably don't want to call this.
type Batcher ¶
type Batcher interface {
// Invoke
//
// batchIdx is the index of the batch object, starting at 0
Invoke(ctx context.Context, exp *Expect, timeout time.Duration, batchIdx int) error
}
Batcher is the simple interface all batch records implement
type Error ¶
Error is the struct that all errors returned by Batch/BatchContext are wrapped in
type Expect ¶
type Expect struct {
//Encoding Encoding
Logger func(msg Log)
Conn net.Conn
// contains filtered or unexported fields
}
func (*Expect) BatchContext ¶
BatchContext allows multiple batched requests/responses. timeout operates on a per command basis, to limit the total time that can be used set a deadline on the passed in context.
