strings

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendQuotedString

func AppendQuotedString(buf []byte, str string) []byte

func CheckName

func CheckName(name string) error

func InterfaceSliceToStringSlice

func InterfaceSliceToStringSlice(input interface{}) interface{}

InterfaceSliceToStringSlice converts a slice of interface{} to a slice of strings. If the input is not a slice of interface{} it is returned unmodified. If the input slice does not consist of strings (only) the input is returned unmodified.

func ParseBool

func ParseBool(b []byte) (bool, error)

func ParseFloat

func ParseFloat(b []byte) (float64, error)

func ParseInt

func ParseInt(b []byte) (i int, err error)

func QuotedBytes

func QuotedBytes(s string) []byte

func ToUpper

func ToUpper(bP *[]byte, s string) string

This is a modified, zero alloc, version of the stdlib function strings.ToUpper. The passed in byte buffer is used to hold the converted string. The returned string is not safe to use when bP goes out of scope and the content may be overwritten upon next call to this function.

func UnsafeBytesToString

func UnsafeBytesToString(in []byte) string

Types

type CIContainsMatcher

type CIContainsMatcher CIStringMatcher

func (*CIContainsMatcher) Matches

func (m *CIContainsMatcher) Matches(s string) bool

type CIExactMatcher

type CIExactMatcher CIStringMatcher

func (*CIExactMatcher) Matches

func (m *CIExactMatcher) Matches(s string) bool

type CIPrefixMatcher

type CIPrefixMatcher CIStringMatcher

func (*CIPrefixMatcher) Matches

func (m *CIPrefixMatcher) Matches(s string) bool

type CIStringMatcher

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

type CISuffixMatcher

type CISuffixMatcher CIStringMatcher

func (*CISuffixMatcher) Matches

func (m *CISuffixMatcher) Matches(s string) bool

type ContainsMatcher

type ContainsMatcher StringMatcher

func (*ContainsMatcher) Matches

func (m *ContainsMatcher) Matches(s string) bool

type ExactMatcher

type ExactMatcher StringMatcher

func (*ExactMatcher) Matches

func (m *ExactMatcher) Matches(s string) bool

type Matcher

type Matcher interface {
	Matches(s string) bool
}

func NewMatcher

func NewMatcher(comparatee string, caseSensitive bool) (Matcher, error)

type Pointer

type Pointer uint64

Pointer identifies a string within a StringBlob. Max individual string size 2^28 byte ~ 268 Mb Max total size 2^35 byte ~ 34 Gb

func NewPointer

func NewPointer(offset, length int, isNull bool) Pointer

func (Pointer) IsNull

func (p Pointer) IsNull() bool

func (Pointer) Len

func (p Pointer) Len() int

func (Pointer) Offset

func (p Pointer) Offset() int

func (Pointer) String

func (p Pointer) String() string

type PrefixMatcher

type PrefixMatcher StringMatcher

func (*PrefixMatcher) Matches

func (m *PrefixMatcher) Matches(s string) bool

type RegexpMatcher

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

func (*RegexpMatcher) Matches

func (m *RegexpMatcher) Matches(s string) bool

type StringBlob

type StringBlob struct {
	Pointers []Pointer
	Data     []byte
}

StringBlob represents a set of strings. The underlying data is stored in a byte blob which can be interpreted through the pointers which identifies the start and end of individual strings in the blob.

This structure is used instead of a slice of strings or a slice of string pointers is to avoid that the GC has to scan all pointers which takes quite some time with large/many live frames.

type StringMatcher

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

type StringSet

type StringSet map[string]struct{}

func NewEmptyStringSet

func NewEmptyStringSet() StringSet

func NewStringSet

func NewStringSet(input []string) StringSet

func (StringSet) Add

func (ss StringSet) Add(s string)

func (StringSet) AsSlice

func (ss StringSet) AsSlice() []string

func (StringSet) Contains

func (ss StringSet) Contains(s string) bool

type SuffixMatcher

type SuffixMatcher StringMatcher

func (*SuffixMatcher) Matches

func (m *SuffixMatcher) Matches(s string) bool

Jump to

Keyboard shortcuts

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