Documentation
¶
Index ¶
- func NewLoggerPortAdapter(adapter *logger.LoggerAdapter) application.Logger
- func NewOSPathOperations() ports.PathOperations
- type LoggerPortAdapter
- func (l *LoggerPortAdapter) Debug(ctx context.Context, msg string, fields ...application.LogField)
- func (l *LoggerPortAdapter) Error(ctx context.Context, msg string, fields ...application.LogField)
- func (l *LoggerPortAdapter) Info(ctx context.Context, msg string, fields ...application.LogField)
- func (l *LoggerPortAdapter) Warn(ctx context.Context, msg string, fields ...application.LogField)
- type MockCommandExecutor
- type NoOpLogger
- func (n *NoOpLogger) Debug(ctx context.Context, msg string, fields ...application.LogField)
- func (n *NoOpLogger) Error(ctx context.Context, msg string, fields ...application.LogField)
- func (n *NoOpLogger) Info(ctx context.Context, msg string, fields ...application.LogField)
- func (n *NoOpLogger) Warn(ctx context.Context, msg string, fields ...application.LogField)
- type OSCommandExecutor
- type OSFileInfo
- type OSFileSystem
- func (f *OSFileSystem) IsNotExist(err error) bool
- func (f *OSFileSystem) MkdirAll(ctx context.Context, path string, perm fs.FileMode) error
- func (f *OSFileSystem) ReadFile(ctx context.Context, path string) ([]byte, error)
- func (f *OSFileSystem) Remove(ctx context.Context, path string) error
- func (f *OSFileSystem) Stat(ctx context.Context, path string) (ports.FileInfo, error)
- func (f *OSFileSystem) Symlink(ctx context.Context, oldname, newname string) error
- func (f *OSFileSystem) Sync(ctx context.Context) error
- func (f *OSFileSystem) WriteFile(ctx context.Context, path string, data []byte, perm fs.FileMode) error
- type OSPathOperations
- func (p *OSPathOperations) Base(path string) string
- func (p *OSPathOperations) Clean(path string) string
- func (p *OSPathOperations) Dir(path string) string
- func (p *OSPathOperations) Ext(path string) string
- func (p *OSPathOperations) IsAbs(path string) bool
- func (p *OSPathOperations) Join(elem ...string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLoggerPortAdapter ¶
func NewLoggerPortAdapter(adapter *logger.LoggerAdapter) application.Logger
NewLoggerPortAdapter creates a new adapter from LoggerAdapter
func NewOSPathOperations ¶
func NewOSPathOperations() ports.PathOperations
NewOSPathOperations creates a new OS path operations adapter
Types ¶
type LoggerPortAdapter ¶
type LoggerPortAdapter struct {
// contains filtered or unexported fields
}
LoggerPortAdapter adapts logger.LoggerAdapter to ports.Logger interface This follows DIP: infrastructure implements the application port
func (*LoggerPortAdapter) Debug ¶
func (l *LoggerPortAdapter) Debug(ctx context.Context, msg string, fields ...application.LogField)
Debug logs a debug-level message
func (*LoggerPortAdapter) Error ¶
func (l *LoggerPortAdapter) Error(ctx context.Context, msg string, fields ...application.LogField)
Error logs an error-level message
func (*LoggerPortAdapter) Info ¶
func (l *LoggerPortAdapter) Info(ctx context.Context, msg string, fields ...application.LogField)
Info logs an info-level message
func (*LoggerPortAdapter) Warn ¶
func (l *LoggerPortAdapter) Warn(ctx context.Context, msg string, fields ...application.LogField)
Warn logs a warning-level message
type MockCommandExecutor ¶
type MockCommandExecutor struct {
// contains filtered or unexported fields
}
MockCommandExecutor implements CommandExecutor for testing
func NewMockCommandExecutor ¶
func NewMockCommandExecutor() *MockCommandExecutor
NewMockCommandExecutor creates a new mock command executor
func (*MockCommandExecutor) Execute ¶
func (m *MockCommandExecutor) Execute(ctx context.Context, cmd application.Command) (application.CommandResult, error)
Execute implements CommandExecutor interface
func (*MockCommandExecutor) SetError ¶
func (m *MockCommandExecutor) SetError(signature string, err error)
SetError configures a mock error for a command
func (*MockCommandExecutor) SetResult ¶
func (m *MockCommandExecutor) SetResult(signature string, result application.CommandResult)
SetResult configures a mock result for a command
type NoOpLogger ¶
type NoOpLogger struct{}
NoOpLogger is a no-op logger implementation for when no logger is provided
func (*NoOpLogger) Debug ¶
func (n *NoOpLogger) Debug(ctx context.Context, msg string, fields ...application.LogField)
Debug does nothing
func (*NoOpLogger) Error ¶
func (n *NoOpLogger) Error(ctx context.Context, msg string, fields ...application.LogField)
Error does nothing
func (*NoOpLogger) Info ¶
func (n *NoOpLogger) Info(ctx context.Context, msg string, fields ...application.LogField)
Info does nothing
func (*NoOpLogger) Warn ¶
func (n *NoOpLogger) Warn(ctx context.Context, msg string, fields ...application.LogField)
Warn does nothing
type OSCommandExecutor ¶
type OSCommandExecutor struct{}
OSCommandExecutor implements CommandExecutor using os/exec package This follows the Adapter pattern to bridge infrastructure and application layer
Design Principles: - Adapter Pattern: Bridges os/exec to application port - DIP: Infrastructure depends on application, not vice versa - Telemetry: Captures stdout/stderr for observability
func NewOSCommandExecutor ¶
func NewOSCommandExecutor() *OSCommandExecutor
NewOSCommandExecutor creates a new OS command executor
func (*OSCommandExecutor) Execute ¶
func (e *OSCommandExecutor) Execute(ctx context.Context, cmd application.Command) (application.CommandResult, error)
Execute implements CommandExecutor interface
type OSFileInfo ¶
type OSFileInfo struct {
// contains filtered or unexported fields
}
OSFileInfo implements ports.FileInfo using os.FileInfo
func (*OSFileInfo) IsDir ¶
func (f *OSFileInfo) IsDir() bool
func (*OSFileInfo) ModTime ¶
func (f *OSFileInfo) ModTime() time.Time
func (*OSFileInfo) Mode ¶
func (f *OSFileInfo) Mode() fs.FileMode
func (*OSFileInfo) Name ¶
func (f *OSFileInfo) Name() string
func (*OSFileInfo) Size ¶
func (f *OSFileInfo) Size() int64
func (*OSFileInfo) Sys ¶
func (f *OSFileInfo) Sys() interface{}
type OSFileSystem ¶
type OSFileSystem struct{}
OSFileSystem implements ports.FileSystem using the standard library's os package
func NewOSFileSystem ¶
func NewOSFileSystem() *OSFileSystem
NewOSFileSystem creates a new OSFileSystem adapter
func (*OSFileSystem) IsNotExist ¶
func (f *OSFileSystem) IsNotExist(err error) bool
IsNotExist checks if an error indicates a file doesn't exist
func (*OSFileSystem) Remove ¶
func (f *OSFileSystem) Remove(ctx context.Context, path string) error
Remove removes a file or directory
func (*OSFileSystem) Symlink ¶
func (f *OSFileSystem) Symlink(ctx context.Context, oldname, newname string) error
Symlink creates a symbolic link
type OSPathOperations ¶
type OSPathOperations struct{}
OSPathOperations implements PathOperations using the standard library
func (*OSPathOperations) Base ¶
func (p *OSPathOperations) Base(path string) string
Base returns the last element of the path
func (*OSPathOperations) Clean ¶
func (p *OSPathOperations) Clean(path string) string
Clean returns the shortest path name equivalent to path
func (*OSPathOperations) Dir ¶
func (p *OSPathOperations) Dir(path string) string
Dir returns the directory part of the path
func (*OSPathOperations) Ext ¶
func (p *OSPathOperations) Ext(path string) string
Ext returns the file extension
func (*OSPathOperations) IsAbs ¶
func (p *OSPathOperations) IsAbs(path string) bool
IsAbs returns true if the path is absolute
func (*OSPathOperations) Join ¶
func (p *OSPathOperations) Join(elem ...string) string
Join joins path elements