utils

package
v0.0.0-...-25e8ccf Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PathSeparator = string(os.PathSeparator)
)

Variables

This section is empty.

Functions

func ComputeStructHash

func ComputeStructHash(template interface{}, collisionCount *int32) string

func ContentTrim

func ContentTrim(contentType, content string) string

func DeepHashObject

func DeepHashObject(hasher hash.Hash, objectToWrite interface{})

DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.

func GenerateContentAbstract

func GenerateContentAbstract(content string) string

func GenerateContentHeaderImage

func GenerateContentHeaderImage(content string) string

func MarshalMap

func MarshalMap(obj any) map[string]interface{}

func SafetyFilePathJoin

func SafetyFilePathJoin(parent, filename string) string

func SanitizeFilename

func SanitizeFilename(name string) string

func UnmarshalMap

func UnmarshalMap(data map[string]interface{}, obj any)

Types

type FileAccess

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

func NewFileAccess

func NewFileAccess(workdir string) *FileAccess

func (*FileAccess) Copy

func (fa *FileAccess) Copy(dstPath, srcPath string, perm os.FileMode) error

func (*FileAccess) Create

func (fa *FileAccess) Create(path string, perm os.FileMode) (*os.File, error)

func (*FileAccess) Exists

func (fa *FileAccess) Exists(path string) bool

func (*FileAccess) GetAbsPath

func (fa *FileAccess) GetAbsPath(path string) (string, error)

func (*FileAccess) MkdirAll

func (fa *FileAccess) MkdirAll(path string, perm os.FileMode) error

func (*FileAccess) Open

func (fa *FileAccess) Open(path string) (*os.File, error)

func (*FileAccess) Read

func (fa *FileAccess) Read(path string) ([]byte, error)

func (*FileAccess) Remove

func (fa *FileAccess) Remove(path string) error

func (*FileAccess) Rename

func (fa *FileAccess) Rename(oldPath, newPath string) error

func (*FileAccess) Stat

func (fa *FileAccess) Stat(path string) (os.FileInfo, error)

func (*FileAccess) ValidatePath

func (fa *FileAccess) ValidatePath(path string) error

func (*FileAccess) Workdir

func (fa *FileAccess) Workdir() string

func (*FileAccess) Write

func (fa *FileAccess) Write(path string, data []byte, perm os.FileMode) error

Jump to

Keyboard shortcuts

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