-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.go
More file actions
39 lines (35 loc) · 1.2 KB
/
interfaces.go
File metadata and controls
39 lines (35 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package wordcounter
// Countable defines the interface for counting operations
type Countable interface {
// Count performs the counting operation
Count() error
// GetHeader returns the header row for export
GetHeader() Row
// GetRows returns the data rows for export
GetRows() []Row
}
// CharacterCounter defines the interface for character counting
type CharacterCounter interface {
// Count counts characters in the given input
Count(input any) error
// CountBytes counts characters from byte slice
CountBytes(data []byte) error
// GetStats returns the counting statistics
GetStats() *Stats
}
// IgnoreChecker defines the interface for checking if files should be ignored
type IgnoreChecker interface {
// IsIgnored checks if a file should be ignored
IsIgnored(filename string) bool
// IsIgnoredWithError checks if a file should be ignored and returns any errors
IsIgnoredWithError(filename string) (bool, error)
// AddIgnorePattern adds a new ignore pattern
AddIgnorePattern(pattern string)
}
// Server defines the interface for server operations
type Server interface {
// Run starts the server on the specified port
Run(port int) error
// Count handles the count request
Count(ctx any) error
}