Documentation
¶
Index ¶
- Variables
- type LineRange
- type Service
- func (s *Service) AppendLines(filePath string, encName string, lines []string) error
- func (s *Service) DeleteLines(filePath string, oldHash string, encName string, lineNumbers []int) error
- func (s *Service) DetectEncoding(filePath string) (encoding.Encoding, string, error)
- func (s *Service) EditLines(filePath string, oldHash string, encName string, lineEdits map[int]string) error
- func (s *Service) InsertLines(filePath string, oldHash string, encName string, position int, ...) error
- func (s *Service) ReadLines(filePath string, encName string, ranges ...LineRange) ([]string, string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFileNotFound is returned when a file does not exist ErrFileNotFound = errors.New("file not found") // ErrContentChanged is returned when the file content has changed since it was last read ErrContentChanged = errors.New("file content has changed") // ErrInvalidRange is returned when an invalid range is specified ErrInvalidRange = errors.New("invalid range specified") // ErrInvalidEncoding is returned when an unsupported encoding is specified ErrInvalidEncoding = errors.New("invalid encoding specified") )
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides file operation methods
func NewService ¶
NewService creates a new file service
func (*Service) AppendLines ¶
AppendLines appends lines to a file
func (*Service) DeleteLines ¶
func (s *Service) DeleteLines(filePath string, oldHash string, encName string, lineNumbers []int) error
DeleteLines deletes lines from a file with hash validation
func (*Service) DetectEncoding ¶
DetectEncoding attempts to detect the encoding of a file
func (*Service) EditLines ¶
func (s *Service) EditLines(filePath string, oldHash string, encName string, lineEdits map[int]string) error
EditLines edits lines in a file with hash validation
Click to show internal directories.
Click to hide internal directories.