Documentation
¶
Index ¶
- Variables
- func AppendAll[E any](appendable Appendable[E], iterable Iterable[E])
- func Close(value any) error
- func CloseQuietly(values ...any)
- func Contains[E comparable](iterable Iterable[E], value E) (match bool)
- 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 IsNetworkRelated(err error) bool
- func Sleep(ctx context.Context, timeout time.Duration) error
- func ToString(in Input) (string, error)
- type AnyCloser
- type Appendable
- type ByteBuffer
- type Bytes
- type Chars
- type Codec
- type Conn
- type Counter
- type DecoderFrom
- type Duration
- type EncoderTo
- type File
- func (f File) Append() (*os.File, error)
- func (f File) Create() (*os.File, error)
- func (f File) CreateParent() error
- func (f File) Exists() (bool, error)
- func (f File) Join(child string) File
- func (f File) Open() (*os.File, error)
- func (f File) Reader() (io.Reader, error)
- func (f File) Remove() error
- func (f File) String() string
- func (f File) Writer() (io.Writer, error)
- type ForEach
- type IO
- type IOCounter
- type Input
- type Iterable
- type Output
- type ReaderCounter
- type Set
- func (s *Set[E]) Append(element E)
- func (s Set[E]) ForEach(forEach ForEach[E])
- func (s Set[E]) MarshalJSON() ([]byte, error)
- func (s Set[E]) MarshalYAML() (interface{}, error)
- func (s Set[E]) Size() int
- func (s *Set[E]) UnmarshalJSON(data []byte) error
- func (s *Set[E]) UnmarshalYAML(node *yaml.Node) error
- type Sizeable
- type Slice
- type Text
- type Time
- type URL
- type ValueCodec
- type WriterCounter
Constants ¶
This section is empty.
Variables ¶
var ( ID = internal.ID Readable = internal.Readable )
var TimeLayout = "2006-01-02 15:04:05"
TimeLayout is the default layout used while parsing Time from a string.
Functions ¶
func AppendAll ¶ added in v0.10.5
func AppendAll[E any](appendable Appendable[E], iterable Iterable[E])
func CloseQuietly ¶
func CloseQuietly(values ...any)
CloseQuietly attempts to close the provided value using io.Closer with logging on error.
func Contains ¶ added in v0.10.5
func Contains[E comparable](iterable Iterable[E], value E) (match bool)
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 IsNetworkRelated ¶
IsNetworkRelated checks if this is a net.Error.
Types ¶
type AnyCloser ¶
type AnyCloser struct {
V any
}
AnyCloser wraps the provided value with io.Closer interface.
type Appendable ¶ added in v0.10.5
type Appendable[E any] interface{ Append(element E) }
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 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 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 ¶
Duration provides useful serialization methods for time.Duration.
func (*Duration) FromString ¶
FromString parses the duration from a string value.
func (Duration) MarshalJSON ¶ added in v0.10.5
func (Duration) MarshalYAML ¶ added in v0.10.5
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.
func (File) CreateParent ¶ added in v0.10.3
type Output ¶
func PipeOutput ¶
func PipeOutput(decoder DecoderFrom) Output
PipeOutput provides an Output which feeds into DecoderFrom in the background.
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 Set ¶ added in v0.10.5
type Set[E constraints.Ordered] map[E]bool
func (Set[E]) MarshalJSON ¶ added in v0.10.5
func (Set[E]) MarshalYAML ¶ added in v0.10.5
func (*Set[E]) UnmarshalJSON ¶ added in v0.10.5
type Text ¶
type Text struct {
Value string
}
Text encodes/decodes the provided value as plain text.
func (*Text) ContentType ¶
type Time ¶ added in v0.10.1
Time is time.Time wrapper with serialization support.
func (*Time) FromString ¶ added in v0.10.1
FromString parses a string.
func (*Time) MarshalJSON ¶ added in v0.10.1
func (*Time) MarshalYAML ¶ added in v0.10.1
func (*Time) UnmarshalJSON ¶ added in v0.10.1
type ValueCodec ¶
type ValueCodec interface {
EncoderTo
DecoderFrom
}
ValueCodec is a value container with encoder and decoder.
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
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
schema
Package schema implements OpenAPI 3 compatible JSON Schema which can be generated from structs.
|
Package schema implements OpenAPI 3 compatible JSON Schema which can be generated from structs. |
|
me3x package contains abstractions for reporting metrics to Graphite or Prometheus.
|
me3x package contains abstractions for reporting metrics to Graphite or Prometheus. |