Documentation ¶
Index ¶
- func AwaitSignal(signals ...os.Signal)
- func Close(value interface{}) error
- func CloseQuietly(value interface{})
- func Copy(in Input, out Output) (written int64, err error)
- func DecodeFrom(in Input, decoder DecoderFrom) error
- func EncodeTo(encoder EncoderTo, out Output) error
- func IsContextRelated(err error) bool
- func IsNetworkRelated(err error) bool
- func Sleep(ctx context.Context, timeout time.Duration) error
- func ToString(in Input) (string, error)
- type AnyCloser
- type ByteBuffer
- type Bytes
- type Chars
- type Clock
- type ClockFunc
- type Codec
- type Conn
- type ContextFunc
- type Counter
- type DecoderFrom
- type Duration
- type EncoderTo
- type File
- type IO
- type IOCounter
- type Input
- type Mutex
- type Output
- type RWMutex
- type RateLimiter
- type ReaderCounter
- type Text
- type URL
- type Unlocker
- type UnlockerFunc
- type ValueCodec
- type WaitGroup
- type WriterCounter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AwaitSignal ¶
func Close ¶
func Close(value interface{}) error
Close attempts to close the provided value using io.Closer interface.
func CloseQuietly ¶
func CloseQuietly(value interface{})
CloseQuietly attempts to close the provided value using io.Closer with logging on error.
func DecodeFrom ¶
func DecodeFrom(in Input, decoder DecoderFrom) error
DecodeFrom decodes the provided DecoderFrom from Input. It closes the io.Reader instance if necessary.
func EncodeTo ¶
EncodeTo encodes the provided EncoderTo to Output. It closes the io.Writer instance if necessary.
func IsContextRelated ¶
func IsNetworkRelated ¶
Types ¶
type AnyCloser ¶
type AnyCloser struct {
V interface{}
}
AnyCloser wraps the provided value with io.Closer interface.
type ByteBuffer ¶
ByteBuffer is an Input / Output wrapper around bytes.Buffer.
func (*ByteBuffer) Bytes ¶
func (b *ByteBuffer) Bytes() Bytes
Bytes returns read-only Bytes view on this buffer.
func (*ByteBuffer) Unmask ¶
func (b *ByteBuffer) Unmask() *bytes.Buffer
Unmask returns the underlying *bytes.Buffer.
type Chars ¶
type Chars struct { // In is the underlying Input. In Input // Out is the underlying Output. Out Output // Enc will be used for decoding characters from Input // and/or encoding them to Output. Enc encoding.Encoding }
Chars is the text character Input / Output wrapper.
type Codec ¶
type Codec func(interface{}) ValueCodec
type Conn ¶
type Conn struct { // Dialer is the net.Dialer to be used for connection. // May be empty. Dialer net.Dialer // Context is the context.ctx to be used. // May be empty. Context context.Context // Network is the network passed to Dialer.Dial. Network string // Address is the address passed to Dialer.Dial. Address string }
Conn provides the means for opening net.Conn.
type ContextFunc ¶
func Deadline ¶
func Deadline(deadline time.Time) ContextFunc
func Timeout ¶
func Timeout(timeout time.Duration) ContextFunc
type DecoderFrom ¶
type DecoderFrom interface { // DecodeFrom decodes the value from the given io.Reader. DecodeFrom(io.Reader) error }
DecoderFrom interface describes a value which can be decoded.
type Duration ¶
func (*Duration) FromString ¶
func (Duration) GetOrDefault ¶
func (*Duration) UnmarshalJSON ¶
type EncoderTo ¶
type EncoderTo interface { // EncodeTo encodes the value to the given io.Writer. EncodeTo(io.Writer) error }
EncoderTo interface describes a value which can be encoded.
type File ¶
type File string
File is a path representing a file (or directory).
func (File) Create ¶
Create opens the File for writing. It creates the file and all intermediate directories if necessary.
type IO ¶
type IO struct { // R is an io.Reader instance to be used for reading. R io.Reader // W is an io.Writer instance to be used for reading. W io.Writer // E is an error which will be returned when reading/writing. E error }
IO is a generic Input / Output. It is not mandatory to fill all struct fields.
type Output ¶
Output interface describes a resource which can be written (possibly more than once).
func PipeOutput ¶
func PipeOutput(decoder DecoderFrom) Output
PipeOutput provides an Output which feeds into DecoderFrom in the background.
type RateLimiter ¶
var RateUnlimiter RateLimiter = rateUnlimiter{}
func ConcurrencyRateLimiter ¶
func ConcurrencyRateLimiter(concurrency int) RateLimiter
func IntervalRateLimiter ¶
func IntervalRateLimiter(interval time.Duration) RateLimiter
type ReaderCounter ¶
ReaderCounter is a counting io.Reader. Useful for calculating the total size of read data.
func (ReaderCounter) Close ¶
func (rc ReaderCounter) Close() error
type Text ¶
type Text struct {
Value string
}
Text encodes/decodes the provided value as plain text.
func (*Text) ContentType ¶
type UnlockerFunc ¶
type UnlockerFunc func()
func (UnlockerFunc) Unlock ¶
func (fun UnlockerFunc) Unlock()
type ValueCodec ¶
type ValueCodec interface { EncoderTo DecoderFrom }
func Gob ¶
func Gob(value interface{}) ValueCodec
func JSON ¶
func JSON(value interface{}) ValueCodec
JSON encodes/decodes the provided ValueCodec using JSON format.
func XML ¶
func XML(value interface{}) ValueCodec
func YAML ¶
func YAML(value interface{}) ValueCodec
type WriterCounter ¶
WriterCounter is a counting io.Writer. Useful for calculating the total size of written data.
func (WriterCounter) Close ¶
func (wc WriterCounter) Close() error