util

package
v0.7.38 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextReadSeekCloser added in v0.3.1

func NewContextReadSeekCloser(ctx context.Context, r io.ReadSeekCloser) io.ReadSeekCloser

func PrettyTitleCase added in v0.7.23

func PrettyTitleCase(name string) string

Returns the (english) string title cased, with minor words (a, an, and, of, on, the, to) lowercased unless they are the first word of the string

func ReadCString added in v0.7.0

func ReadCString(r io.Reader) (string, error)

Reads a null-terminated string from r (including null terminator) and returns it as a Go string (without null terminator).

If the reader hits EOF before a null terminator, returns ErrUnexpectedEOF along with the so far read string.

Returns an empty string and error if any other error is encountered.

func ReadCStringSkipLeadingNulls added in v0.7.37

func ReadCStringSkipLeadingNulls(r io.Reader) (string, error)

Like ReadCString, but skips any leading null bytes.

func Uniq added in v0.7.37

func Uniq[S ~[]E, E comparable](s S) S

Deletes all consecutive duplicate elements, like Unix uniq.

func UniqFunc added in v0.7.37

func UniqFunc[S ~[]E, E any](s S, equal func(E, E) bool) S

Like Uniq, but takes a function to check equality.

Types

type SectionReadSeeker

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

func NewSectionReadSeeker

func NewSectionReadSeeker(r io.ReadSeeker, off int64, n int64) (*SectionReadSeeker, error)

func (*SectionReadSeeker) Read

func (r *SectionReadSeeker) Read(p []byte) (n int, err error)

func (*SectionReadSeeker) Seek

func (r *SectionReadSeeker) Seek(offset int64, whence int) (int64, error)

Jump to

Keyboard shortcuts

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