iohelp

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package iohelp provides common io utilities for bebop generated code.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrUnpopulatedUnion indicates a union had no contents, when exactly
	// one member should be populated
	ErrUnpopulatedUnion error = errors.New("union has no populated member")
)

Functions

func MustReadStringBytes added in v0.0.5

func MustReadStringBytes(buf []byte) string

func MustReadStringBytesSharedMemory added in v0.1.2

func MustReadStringBytesSharedMemory(buf []byte) string

func ReadBool added in v0.0.4

func ReadBool(r *ErrorReader) bool

func ReadBoolBytes added in v0.0.5

func ReadBoolBytes(buf []byte) bool

func ReadByte added in v0.0.4

func ReadByte(r *ErrorReader) byte

func ReadByteBytes added in v0.0.5

func ReadByteBytes(buf []byte) byte

func ReadDate added in v0.0.5

func ReadDate(r *ErrorReader) time.Time

func ReadDateBytes added in v0.0.5

func ReadDateBytes(buf []byte) time.Time

func ReadFloat32 added in v0.0.4

func ReadFloat32(r *ErrorReader) float32

func ReadFloat32Bytes added in v0.0.5

func ReadFloat32Bytes(buf []byte) float32

func ReadFloat64 added in v0.0.4

func ReadFloat64(r *ErrorReader) float64

func ReadFloat64Bytes added in v0.0.5

func ReadFloat64Bytes(buf []byte) float64

func ReadGUID

func ReadGUID(r *ErrorReader) [16]byte

func ReadGUIDBytes added in v0.0.5

func ReadGUIDBytes(buf []byte) [16]byte

func ReadInt16 added in v0.0.4

func ReadInt16(r *ErrorReader) int16

func ReadInt16Bytes added in v0.0.5

func ReadInt16Bytes(buf []byte) int16

func ReadInt32 added in v0.0.4

func ReadInt32(r *ErrorReader) int32

func ReadInt32Bytes added in v0.0.5

func ReadInt32Bytes(buf []byte) int32

func ReadInt64 added in v0.0.4

func ReadInt64(r *ErrorReader) int64

func ReadInt64Bytes added in v0.0.5

func ReadInt64Bytes(buf []byte) int64

func ReadString

func ReadString(r *ErrorReader) string

func ReadStringBytes added in v0.0.5

func ReadStringBytes(buf []byte) (string, error)

func ReadStringBytesSharedMemory added in v0.1.2

func ReadStringBytesSharedMemory(buf []byte) (string, error)

func ReadUint16 added in v0.0.4

func ReadUint16(r *ErrorReader) uint16

func ReadUint16Bytes added in v0.0.5

func ReadUint16Bytes(buf []byte) uint16

func ReadUint32 added in v0.0.4

func ReadUint32(r *ErrorReader) uint32

func ReadUint32Bytes added in v0.0.5

func ReadUint32Bytes(buf []byte) uint32

func ReadUint64 added in v0.0.4

func ReadUint64(r *ErrorReader) uint64

func ReadUint64Bytes added in v0.0.5

func ReadUint64Bytes(buf []byte) uint64

func ReadUint8 added in v0.0.4

func ReadUint8(r *ErrorReader) uint8

func ReadUint8Bytes added in v0.0.5

func ReadUint8Bytes(buf []byte) uint8

func WriteBool added in v0.0.4

func WriteBool(w *ErrorWriter, b bool)

func WriteBoolBytes added in v0.0.5

func WriteBoolBytes(b []byte, bl bool)

func WriteByte added in v0.0.4

func WriteByte(w *ErrorWriter, b byte)

func WriteByteBytes added in v0.0.5

func WriteByteBytes(b []byte, by byte)

func WriteFloat32 added in v0.0.4

func WriteFloat32(w *ErrorWriter, f float32)

func WriteFloat32Bytes added in v0.0.5

func WriteFloat32Bytes(b []byte, f float32)

func WriteFloat64 added in v0.0.4

func WriteFloat64(w *ErrorWriter, f float64)

func WriteFloat64Bytes added in v0.0.5

func WriteFloat64Bytes(b []byte, f float64)

func WriteGUID

func WriteGUID(w *ErrorWriter, guid [16]byte)

func WriteGUIDBytes added in v0.0.5

func WriteGUIDBytes(b []byte, guid [16]byte)

func WriteInt16 added in v0.0.4

func WriteInt16(w *ErrorWriter, i int16)

func WriteInt16Bytes added in v0.0.5

func WriteInt16Bytes(b []byte, i int16)

func WriteInt32 added in v0.0.4

func WriteInt32(w *ErrorWriter, i int32)

func WriteInt32Bytes added in v0.0.5

func WriteInt32Bytes(b []byte, i int32)

func WriteInt64 added in v0.0.4

func WriteInt64(w *ErrorWriter, i int64)

func WriteInt64Bytes added in v0.0.5

func WriteInt64Bytes(b []byte, i int64)

func WriteUint16 added in v0.0.4

func WriteUint16(w *ErrorWriter, i uint16)

func WriteUint16Bytes added in v0.0.5

func WriteUint16Bytes(b []byte, i uint16)

func WriteUint32 added in v0.0.4

func WriteUint32(w *ErrorWriter, i uint32)

func WriteUint32Bytes added in v0.0.5

func WriteUint32Bytes(b []byte, i uint32)

func WriteUint64 added in v0.0.4

func WriteUint64(w *ErrorWriter, i uint64)

func WriteUint64Bytes added in v0.0.5

func WriteUint64Bytes(b []byte, i uint64)

func WriteUint8 added in v0.0.4

func WriteUint8(w *ErrorWriter, b uint8)

func WriteUint8Bytes added in v0.0.5

func WriteUint8Bytes(b []byte, by uint8)

Types

type ErrorReader

type ErrorReader struct {
	Reader io.Reader
	Err    error
	// contains filtered or unexported fields
}

An ErrorReader wraps an io.Reader with a reusable buffer for small allocations of structured data types and persistent error tracking.

func NewErrorReader added in v0.0.4

func NewErrorReader(r io.Reader) *ErrorReader

NewErrorReader wraps a reader with error tracking. An ErrorReader not created via NewErrorReader is not safe to use.

func (*ErrorReader) Drain added in v0.5.0

func (er *ErrorReader) Drain()

func (*ErrorReader) Read

func (er *ErrorReader) Read(b []byte) (n int, err error)

type ErrorWriter

type ErrorWriter struct {
	Writer io.Writer
	Err    error
	// contains filtered or unexported fields
}

An ErrorWriter wraps an io.Writer with a reusable buffer for small allocations of structured data types and persistent error tracking.

func NewErrorWriter added in v0.0.4

func NewErrorWriter(w io.Writer) *ErrorWriter

NewErrorWriter wraps a writer with error tracking. An ErrorWriter not created via NewErrorWriter is not safe to use.

func (*ErrorWriter) SafeWrite added in v0.5.0

func (ew *ErrorWriter) SafeWrite(b []byte) int

SafeWrite will only write if ew.Err is not set, and will set it if a write fails.

func (*ErrorWriter) Write

func (ew *ErrorWriter) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL