fix: change interface{} to any in local_storage.go

This commit is contained in:
Patryk Hegenberg 2025-09-23 14:58:31 +02:00
parent 366aac9edc
commit 368a3cf062

View file

@ -141,7 +141,7 @@ func (s *SQLiteStorage) StoreBatch(ctx context.Context, entries []LogEntry) erro
func (s *SQLiteStorage) Query(ctx context.Context, query StorageQuery) ([]LogEntry, error) { func (s *SQLiteStorage) Query(ctx context.Context, query StorageQuery) ([]LogEntry, error) {
sqlQuery := "SELECT service, timestamp, type, host, tool, log_level, log_message, raw, priority, priority_name, unit, pid, boot_id, machine_id, fields, service_information, system_metrics, tool_information FROM log_entries WHERE 1=1" sqlQuery := "SELECT service, timestamp, type, host, tool, log_level, log_message, raw, priority, priority_name, unit, pid, boot_id, machine_id, fields, service_information, system_metrics, tool_information FROM log_entries WHERE 1=1"
args := []interface{}{} args := []any{}
argCount := 0 argCount := 0
if !query.StartTime.IsZero() { if !query.StartTime.IsZero() {
@ -252,11 +252,11 @@ func (s *SQLiteStorage) MarkAsExported(ctx context.Context, ids []int64) error {
} }
placeholders := strings.Repeat("?,", len(ids)) placeholders := strings.Repeat("?,", len(ids))
placeholders = placeholders[:len(placeholders)-1] // Remove trailing comma placeholders = placeholders[:len(placeholders)-1]
sqlQuery := fmt.Sprintf("UPDATE log_entries SET exported_at = CURRENT_TIMESTAMP WHERE id IN (%s)", placeholders) sqlQuery := fmt.Sprintf("UPDATE log_entries SET exported_at = CURRENT_TIMESTAMP WHERE id IN (%s)", placeholders)
args := make([]interface{}, len(ids)) args := make([]any, len(ids))
for i, id := range ids { for i, id := range ids {
args[i] = id args[i] = id
} }
@ -266,11 +266,6 @@ func (s *SQLiteStorage) MarkAsExported(ctx context.Context, ids []int64) error {
} }
func (s *SQLiteStorage) GetUnexportedEntries(ctx context.Context, limit int) ([]LogEntry, error) { func (s *SQLiteStorage) GetUnexportedEntries(ctx context.Context, limit int) ([]LogEntry, error) {
// query := StorageQuery{
// Limit: limit,
// OrderBy: "timestamp",
// }
sqlQuery := `SELECT id, service, timestamp, type, host, tool, log_level, log_message, raw, priority, priority_name, sqlQuery := `SELECT id, service, timestamp, type, host, tool, log_level, log_message, raw, priority, priority_name,
unit, pid, boot_id, machine_id, fields, service_information, system_metrics, tool_information unit, pid, boot_id, machine_id, fields, service_information, system_metrics, tool_information
FROM log_entries WHERE exported_at IS NULL ORDER BY timestamp ASC` FROM log_entries WHERE exported_at IS NULL ORDER BY timestamp ASC`