Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Driver string
Source string
MaxOpenConns int
MaxIdleConns int
ConnMaxLifetime time.Duration
MigrationPath string
}
holds database configuration
type DB ¶
db.sql configuration with additional configurations
func Initialize ¶
creates a new connection and applies configuration
type MessageRepository ¶
type MessageRepository interface {
SaveMessage(ctx context.Context, message *Message) error
GetMessageHistory(ctx context.Context, chatID int, limit, offset int) ([]Message, error)
}
defines the interface for message storage operations
type PostgresMessageRepository ¶
type PostgresMessageRepository struct {
// contains filtered or unexported fields
}
implements MessageRepository for PostGresSQL
func NewPostgresMessageRepository ¶
func NewPostgresMessageRepository(db *sql.DB) *PostgresMessageRepository
creates a new instance of PostGresMessageRepository
func (*PostgresMessageRepository) Close ¶
func (repo *PostgresMessageRepository) Close() error
closes the repository connection
func (*PostgresMessageRepository) GetMessageHistory ¶
func (rep *PostgresMessageRepository) GetMessageHistory(ctx context.Context, chatID int, limit, offset int) ([]Message, error)
retrieves the message history for a given chat
func (*PostgresMessageRepository) SaveMessage ¶
func (rep *PostgresMessageRepository) SaveMessage(ctx context.Context, message *Message) error
stores a new message in the database
Click to show internal directories.
Click to hide internal directories.