package
0.0.0-20250114092647-a3d21043d0f0
Repository: https://github.com/golangtroshin/shorturl.git
Documentation: pkg.go.dev

# Functions

CloseDB closes the active database connection.
GetStorageByConfig initializes and returns the appropriate storage system based on the application configuration (e.g., database, file, or memory storage).
NewConsumer creates a new Consumer for reading from the specified file path.
NewDatabaseStore creates a new DatabaseStore instance and initializes the database connection.
NewDeletedURLError creates a new instance of DeletedURLError indicating the requested URL was deleted.
NewFileStore initializes and returns a new FileStore instance.
NewInsertConflictError creates a new instance of InsertConflictError indicating a conflict due to an already existing origin URL.
NewMemoryStore initializes and returns a new MemoryStore instance.
NewProducer creates a new Producer for writing to the specified file path.

# Variables

DB represents the global database connection instance used by DatabaseStore.

# Structs

Consumer is responsible for reading URL data from the file in JSON format.
DatabaseStore represents the structure for database operations.
DeletedURLError represents an error when a requested URL has been marked as deleted.
FileStore represents the file-based storage for URLs.
InsertConflictError represents an error when a conflict occurs during an INSERT operation, typically due to a unique constraint violation.
MemoryStore represents an in-memory storage for URLs.
Producer is responsible for writing URL data to the file in JSON format.
RequestBodyBanch represents the structure of a batch request for shortening multiple URLs.
RequestURL represents the structure for incoming API requests to shorten a URL.
ResponseShortURL represents the structure of the API response for a shortened URL.
Stats holds statistical information about saved URLs and users.
URL represents a mapping between a short URL and its original URL.

# Interfaces

Storage defines the interface for a URL storage system.