util

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape

func Escape(a string) string

Escape * Tab is escaped as `\t`. * Carriage return is escaped as `\r`. * Line feed is escaped as `\n`. * Single quote is escaped as `\'`. * Double quote is escaped as `\"`. * Backslash is escaped as `\\`.

func IsExecutable

func IsExecutable(file os.FileInfo) bool

func IsExecutableMode

func IsExecutableMode(mode os.FileMode) bool
func IsSymLink(file os.FileInfo) bool

func IsSymLinkMode

func IsSymLinkMode(mode os.FileMode) bool
func MakeLink(abs string, name string) string

func MountsOn

func MountsOn(info *item.FileInfo) string

func RecursivelySizeOf

func RecursivelySizeOf(info os.FileInfo, depth int) int64

RecursivelySizeOf returns the size of the file or directory depth < 0 means no limit

func RemoveSep

func RemoveSep(s string) string

Types

type Once

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

func (*Once) Do

func (o *Once) Do(fn func() error) error

type SafeSet

type SafeSet[T constval.Hashable] struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet[T constval.Hashable]() *SafeSet[T]

func (*SafeSet[T]) Add

func (s *SafeSet[T]) Add(k T)

func (*SafeSet[T]) Contains

func (s *SafeSet[T]) Contains(k T) bool

type Slice

type Slice[T any] struct {
	// contains filtered or unexported fields
}

func NewSlice

func NewSlice[T any](size int) *Slice[T]

func (*Slice[T]) AppendTo

func (s *Slice[T]) AppendTo(d T)

func (*Slice[T]) At

func (s *Slice[T]) At(pos int) T

func (*Slice[T]) Clear

func (s *Slice[T]) Clear()

func (*Slice[T]) GetCopy

func (s *Slice[T]) GetCopy() []T

func (*Slice[T]) GetRaw

func (s *Slice[T]) GetRaw() *[]T

func (*Slice[T]) Len

func (s *Slice[T]) Len() int

func (*Slice[T]) Set

func (s *Slice[T]) Set(pos int, d T)

Jump to

Keyboard shortcuts

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