Documentation
¶
Overview ¶
Package utils provides utility functions for file operations, error handling, and logging.
Index ¶
- func CopyFile(src, dst string) error
- func CreateDir(path string) error
- func DirExists(path string) bool
- func EnsureDir(path string) error
- func FileExists(path string) bool
- func IsEmptyDir(path string) (bool, error)
- func ListDir(path string) ([]os.DirEntry, error)
- func NewDevelopmentLogger() (*zerolog.Logger, error)
- func NewLogger(debug bool) (*zerolog.Logger, error)
- func NewProductionLogger() (*zerolog.Logger, error)
- func ReadFile(path string) ([]byte, error)
- func ReadFileAsString(path string) (string, error)
- func RemoveDir(path string) error
- func RemoveFile(path string) error
- func WriteFile(path string, content []byte) error
- type UserError
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsEmptyDir ¶
IsEmptyDir checks if a directory is empty
func NewDevelopmentLogger ¶
NewDevelopmentLogger creates a development logger
func NewProductionLogger ¶
NewProductionLogger creates a production logger
func ReadFileAsString ¶
ReadFileAsString reads a file and returns it as a string
Types ¶
type UserError ¶
UserError represents an error with a user-friendly message and solution
func NewUserError ¶
NewUserError creates a new UserError
type ValidationError ¶
ValidationError represents a validation error
func NewValidationError ¶
func NewValidationError(field, message string) *ValidationError
NewValidationError creates a new ValidationError
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.