bytes

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int

func Int(i any) int

func IsBlank

func IsBlank(c byte) bool

IsBlank returns true if provided byte is space or a new line.

func IsDigit

func IsDigit(c byte) bool

IsDigit returns true if provided byte is a digit.

func IsHexDigit

func IsHexDigit(c byte) bool

IsHexDigit returns true if provided byte is a hex digit.

func IsNewLine

func IsNewLine(c byte) bool

IsNewLine returns true if provided byte is a new line.

func IsSpace

func IsSpace(c byte) bool

IsSpace returns true is provided byte is space.

func IsValidUserTypeNameByte

func IsValidUserTypeNameByte(c byte) bool

IsValidUserTypeNameByte returns true if specified rune can be a part of user type name. Important: `@` isn't valid here 'cause schema name should start with `@` but it didn't allow to use that symbol in the name.

func QuoteChar

func QuoteChar(c byte) string

QuoteChar formats char as a quoted character literal.

Types

type ByteKeeper added in v0.2.0

type ByteKeeper interface {
	string | []byte | Bytes
}

ByteKeeper all allowed types for specifying Byte constructor

type Bytes

type Bytes struct {
	// contains filtered or unexported fields
}

func MakeBytes

func MakeBytes(size int) Bytes

func NewBytes

func NewBytes[T ByteKeeper](data T) Bytes

func (*Bytes) Append

func (b *Bytes) Append(c byte)

func (Bytes) BeginningOfLine

func (b Bytes) BeginningOfLine(index Index) Index

func (Bytes) Byte

func (b Bytes) Byte(i any) byte

func (Bytes) CountSpacesFromLeft

func (b Bytes) CountSpacesFromLeft() int

func (Bytes) Data

func (b Bytes) Data() []byte

func (Bytes) DecodeRune

func (b Bytes) DecodeRune() rune

func (Bytes) EndOfLine

func (b Bytes) EndOfLine(index Index) Index

func (Bytes) Equals

func (b Bytes) Equals(bb Bytes) bool

func (Bytes) FirstByte

func (b Bytes) FirstByte() byte

func (Bytes) InQuotes

func (b Bytes) InQuotes() bool

InQuotes the function is only needed in order not to modify the library function unquoteBytes()

func (Bytes) IsNil

func (b Bytes) IsNil() bool

func (Bytes) IsUserTypeName

func (b Bytes) IsUserTypeName() bool

func (Bytes) LastByte

func (b Bytes) LastByte() byte

func (Bytes) Len

func (b Bytes) Len() int

func (Bytes) LenIndex

func (b Bytes) LenIndex() Index

func (Bytes) LineAndColumn

func (b Bytes) LineAndColumn(index Index) (line, column Index)

LineAndColumn calculate the line and column numbers by byte index in the content return 0 if not found

func (Bytes) NewLineSymbol

func (b Bytes) NewLineSymbol() byte

func (Bytes) OneOf

func (b Bytes) OneOf(ss ...string) bool

OneOf checks current bytes sequence equal to at least one of specified strings.

func (Bytes) ParseBool

func (b Bytes) ParseBool() (bool, error)

func (Bytes) ParseInt

func (b Bytes) ParseInt() (int, error)

func (Bytes) ParseUint

func (b Bytes) ParseUint() (uint, error)

func (Bytes) String

func (b Bytes) String() string

func (Bytes) Sub

func (b Bytes) Sub(low, high any) Bytes

func (Bytes) SubHigh

func (b Bytes) SubHigh(high any) Bytes

func (Bytes) SubLow

func (b Bytes) SubLow(low any) Bytes

func (Bytes) SubToEndOfLine

func (b Bytes) SubToEndOfLine(start Index) (Bytes, error)

func (Bytes) ToLower added in v0.2.0

func (b Bytes) ToLower() Bytes

func (Bytes) TrimSpaces

func (b Bytes) TrimSpaces() Bytes

func (Bytes) TrimSpacesFromLeft

func (b Bytes) TrimSpacesFromLeft() Bytes

func (Bytes) TrimSquareBrackets

func (b Bytes) TrimSquareBrackets() Bytes

func (Bytes) Unquote

func (b Bytes) Unquote() Bytes

type Index

type Index uint

func (Index) Int added in v0.2.0

func (i Index) Int() int

func (Index) String added in v0.2.0

func (i Index) String() string

func (Index) Uint added in v0.2.0

func (i Index) Uint() uint

Jump to

Keyboard shortcuts

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