Documentation
¶
Index ¶
- type DB
- func (db *DB) CleanupOldLogs(retentionDays int) (int64, error)
- func (db *DB) Close() error
- func (db *DB) GetAllLogs() ([]RequestLog, error)
- func (db *DB) GetEndpointStats() ([]EndpointStats, error)
- func (db *DB) GetLogs(limit int) ([]RequestLog, error)
- func (db *DB) GetSourceStats() ([]SourceStats, error)
- func (db *DB) GetSummary() (*Summary, error)
- func (db *DB) LogRequest(ipAddress, url string) error
- func (db *DB) Ping() error
- type EndpointStats
- type RequestLog
- type SourceStats
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps the sql.DB connection
func (*DB) CleanupOldLogs ¶
CleanupOldLogs deletes logs older than retentionDays and returns the number deleted If retentionDays is 0, no cleanup is performed
func (*DB) GetAllLogs ¶
func (db *DB) GetAllLogs() ([]RequestLog, error)
GetAllLogs retrieves all request logs from the database with a safety limit
func (*DB) GetEndpointStats ¶
func (db *DB) GetEndpointStats() ([]EndpointStats, error)
GetEndpointStats retrieves statistics grouped by endpoint/URL
func (*DB) GetLogs ¶
func (db *DB) GetLogs(limit int) ([]RequestLog, error)
GetLogs retrieves request logs with optional limit
func (*DB) GetSourceStats ¶
func (db *DB) GetSourceStats() ([]SourceStats, error)
GetSourceStats retrieves statistics grouped by IP address
func (*DB) GetSummary ¶
GetSummary retrieves overall statistics
func (*DB) LogRequest ¶
LogRequest logs an HTTP request to the database with retry logic
type EndpointStats ¶
type EndpointStats struct {
URL string `json:"url"`
Count int64 `json:"count"`
FirstSeen time.Time `json:"first_seen"`
LastSeen time.Time `json:"last_seen"`
UniqueIPs int64 `json:"unique_ips"`
}
EndpointStats represents statistics for a specific endpoint
type RequestLog ¶
RequestLog represents a logged HTTP request
Click to show internal directories.
Click to hide internal directories.