Documentation
¶
Overview ¶
package parse implement parsing primitives
Index ¶
- Variables
- func Decimal(b []byte) (i uint64, n int)
- func Float(b []byte) (f float64, n int)
- func Guid(in []byte) (guid [16]byte, err error)
- func Hex(b []byte) (i uint64, n int)
- func Number(b []byte, base uint64) (i uint64, n int)
- type Buffer
- func (b *Buffer) Clear()
- func (b *Buffer) Empty() bool
- func (b *Buffer) FetchData() (d []byte)
- func (b *Buffer) Full() bool
- func (b *Buffer) GetData() []byte
- func (b *Buffer) Push(c byte) (err error)
- func (b *Buffer) ReadFrom(r io.Reader) (n int64, err error)
- func (b *Buffer) WriteTo(w io.Writer) (n int64, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrGUIDParse = errors.New("guid: Cannot parse")
ErrGUIDParse is returned if input couldn't be parsed
var ( // ErrOutOfBounds returned when buffer run out of space. ErrOutOfBounds = errors.New("Buffer index out of bounds") )
Functions ¶
func Decimal ¶
Decimal parses all decimal digits from start of the given byte slice. If a non-digit is met, parsing stops. Return n - number of bytes read, and i - the value found.
func Float ¶
Float parses a floating point value from start of the given byte slice. If a non-compliant byte is met, parsing stops. Return n - number of bytes read, and f - the value found.
func Guid ¶
Guid parses a byte slice and turn it into a GUID (16 byte array). Any dashes are ignored.
func Hex ¶
Hex parses all hexadecimal digits from start of the given byte slice. If a non-hexdigit is met, parsing stops. Return n - number of bytes read, and i - the value found.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func NewBuffer ¶
NewBuffer creates a new bounded buffer for tokenizers. The buffer support byte appending