common

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration in a human-readable way

func FormatProgress

func FormatProgress(completed, total int) string

FormatProgress formats progress as a percentage

Types

type Action

type Action struct {
	// Type is the type of action
	Type ActionType
	// NotificationID is the ID of the notification
	NotificationID string
	// RepositoryName is the name of the repository
	RepositoryName string
	// Timestamp is when the action was performed
	Timestamp time.Time
	// Success indicates whether the action was successful
	Success bool
	// Error is the error that occurred, if any
	Error error
	// Metadata is additional information about the action
	Metadata map[string]interface{}
}

Action represents an action performed on a notification

type ActionResult

type ActionResult struct {
	// Action is the action that was performed
	Action Action
	// Success indicates whether the action was successful
	Success bool
	// Error is the error that occurred, if any
	Error error
}

ActionResult represents the result of an action

type ActionType

type ActionType string

ActionType represents the type of action

const (
	// ActionMarkAsRead represents marking a notification as read
	ActionMarkAsRead ActionType = "mark_as_read"
	// ActionMarkAllAsRead represents marking all notifications as read
	ActionMarkAllAsRead ActionType = "mark_all_as_read"
	// ActionArchive represents archiving a notification
	ActionArchive ActionType = "archive"
	// ActionUnarchive represents unarchiving a notification
	ActionUnarchive ActionType = "unarchive"
	// ActionSubscribe represents subscribing to a thread
	ActionSubscribe ActionType = "subscribe"
	// ActionUnsubscribe represents unsubscribing from a thread
	ActionUnsubscribe ActionType = "unsubscribe"
	// ActionMute represents muting a repository
	ActionMute ActionType = "mute"
)

type BatchOptions

type BatchOptions struct {
	// Concurrency is the number of concurrent operations
	Concurrency int
	// ProgressCallback is called when progress is made
	ProgressCallback func(completed, total int)
	// ErrorCallback is called when an error occurs
	ErrorCallback func(notificationID string, err error)
	// ContinueOnError indicates whether to continue on error
	ContinueOnError bool
	// Timeout is the maximum time to wait for the operation to complete
	Timeout time.Duration
}

BatchOptions represents options for batch operations

type BatchResult

type BatchResult struct {
	// TotalCount is the total number of operations
	TotalCount int
	// SuccessCount is the number of successful operations
	SuccessCount int
	// FailureCount is the number of failed operations
	FailureCount int
	// Results is the results of each operation
	Results []ActionResult
	// Errors is the errors that occurred
	Errors []error
	// Duration is how long the operation took
	Duration time.Duration
}

BatchResult represents the result of a batch operation

type UndoResult

type UndoResult struct {
	// OriginalAction is the action that was undone
	OriginalAction Action
	// UndoAction is the action that was performed to undo the original action
	UndoAction Action
	// Success indicates whether the undo was successful
	Success bool
	// Error is the error that occurred, if any
	Error error
}

UndoResult represents the result of an undo operation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL