Documentation
¶
Index ¶
- func New(ctx any, cfg config.DatabaseConfig, logger *logger.Logger) (domain.Repository, error)
- func NewSQLiteRepository(dbPath string, logger *logger.Logger) (domain.Repository, error)
- func OpenSQLiteForTesting(dbPath string) (*sql.DB, error)
- type CSVRepository
- func (r *CSVRepository) AddUser(ctx any, user *domain.User) error
- func (r *CSVRepository) Close() error
- func (r *CSVRepository) FindByEmail(ctx any, email string) (*domain.User, error)
- func (r *CSVRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
- func (r *CSVRepository) UpdateUser(ctx any, user *domain.User) error
- type GoogleSheetRepository
- func (r *GoogleSheetRepository) AddUser(ctx any, user *domain.User) error
- func (r *GoogleSheetRepository) Close() error
- func (r *GoogleSheetRepository) FindByEmail(ctx any, email string) (*domain.User, error)
- func (r *GoogleSheetRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
- func (r *GoogleSheetRepository) UpdateUser(ctx any, user *domain.User) error
- type MongoDBRepository
- func (r *MongoDBRepository) AddUser(ctx any, user *domain.User) error
- func (r *MongoDBRepository) Close() error
- func (r *MongoDBRepository) FindByEmail(ctx any, email string) (*domain.User, error)
- func (r *MongoDBRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
- func (r *MongoDBRepository) UpdateUser(ctx any, user *domain.User) error
- type MySQLRepository
- func (r *MySQLRepository) AddUser(ctx any, user *domain.User) error
- func (r *MySQLRepository) Close() error
- func (r *MySQLRepository) FindByEmail(ctx any, email string) (*domain.User, error)
- func (r *MySQLRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
- func (r *MySQLRepository) UpdateUser(ctx any, user *domain.User) error
- type PostgresRepository
- func (r *PostgresRepository) AddUser(ctx any, user *domain.User) error
- func (r *PostgresRepository) Close() error
- func (r *PostgresRepository) FindByEmail(ctx any, email string) (*domain.User, error)
- func (r *PostgresRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
- func (r *PostgresRepository) UpdateUser(ctx any, user *domain.User) error
- type SQLiteRepository
- func (r *SQLiteRepository) AddUser(ctx any, user *domain.User) error
- func (r *SQLiteRepository) Close() error
- func (r *SQLiteRepository) FindByEmail(ctx any, email string) (*domain.User, error)
- func (r *SQLiteRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
- func (r *SQLiteRepository) UpdateUser(ctx any, user *domain.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(ctx any, cfg config.DatabaseConfig, logger *logger.Logger) (domain.Repository, error)
New creates a new repository instance based on the database configuration
func NewSQLiteRepository ¶
NewSQLiteRepository creates a new SQLite repository
Types ¶
type CSVRepository ¶
type CSVRepository struct {
// contains filtered or unexported fields
}
func NewCSVRepository ¶
func NewCSVRepository(filePath string, logger *logger.Logger) (*CSVRepository, error)
func (*CSVRepository) Close ¶
func (r *CSVRepository) Close() error
func (*CSVRepository) FindByEmail ¶
func (*CSVRepository) GetReport ¶
func (r *CSVRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
GetReport retrieves users based on the report parameters
func (*CSVRepository) UpdateUser ¶
func (r *CSVRepository) UpdateUser(ctx any, user *domain.User) error
type GoogleSheetRepository ¶
type GoogleSheetRepository struct {
// contains filtered or unexported fields
}
func (*GoogleSheetRepository) AddUser ¶
func (r *GoogleSheetRepository) AddUser(ctx any, user *domain.User) error
AddUser adds a new user to the Google Sheet
func (*GoogleSheetRepository) Close ¶
func (r *GoogleSheetRepository) Close() error
func (*GoogleSheetRepository) FindByEmail ¶
func (*GoogleSheetRepository) GetReport ¶
func (r *GoogleSheetRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
GetReport retrieves users based on the report parameters
func (*GoogleSheetRepository) UpdateUser ¶
func (r *GoogleSheetRepository) UpdateUser(ctx any, user *domain.User) error
type MongoDBRepository ¶
type MongoDBRepository struct {
// contains filtered or unexported fields
}
MongoDBRepository implements a MongoDB-backed repository
func NewMongoDBRepository ¶
func NewMongoDBRepository(ctx any, connectionString string, logger *logger.Logger) (*MongoDBRepository, error)
NewMongoDBRepository creates a new MongoDB repository
func (*MongoDBRepository) AddUser ¶
func (r *MongoDBRepository) AddUser(ctx any, user *domain.User) error
AddUser adds a new user to the database
func (*MongoDBRepository) Close ¶
func (r *MongoDBRepository) Close() error
func (*MongoDBRepository) FindByEmail ¶
FindByEmail finds a user by email
func (*MongoDBRepository) GetReport ¶
func (r *MongoDBRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
GetReport retrieves users based on the report parameters
func (*MongoDBRepository) UpdateUser ¶
func (r *MongoDBRepository) UpdateUser(ctx any, user *domain.User) error
UpdateUser updates a user in the repository
type MySQLRepository ¶
type MySQLRepository struct {
// contains filtered or unexported fields
}
func NewMySQLRepository ¶
func (*MySQLRepository) AddUser ¶
func (r *MySQLRepository) AddUser(ctx any, user *domain.User) error
AddUser adds a new user to the database
func (*MySQLRepository) Close ¶
func (r *MySQLRepository) Close() error
func (*MySQLRepository) FindByEmail ¶
func (*MySQLRepository) GetReport ¶
func (r *MySQLRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
GetReport retrieves users based on the report parameters
func (*MySQLRepository) UpdateUser ¶
func (r *MySQLRepository) UpdateUser(ctx any, user *domain.User) error
type PostgresRepository ¶
type PostgresRepository struct {
// contains filtered or unexported fields
}
func NewPostgresRepository ¶
func (*PostgresRepository) AddUser ¶
func (r *PostgresRepository) AddUser(ctx any, user *domain.User) error
AddUser adds a new user to the database
func (*PostgresRepository) Close ¶
func (r *PostgresRepository) Close() error
func (*PostgresRepository) FindByEmail ¶
func (*PostgresRepository) GetReport ¶
func (r *PostgresRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
GetReport retrieves users based on the report parameters
func (*PostgresRepository) UpdateUser ¶
func (r *PostgresRepository) UpdateUser(ctx any, user *domain.User) error
type SQLiteRepository ¶
type SQLiteRepository struct {
// contains filtered or unexported fields
}
SQLiteRepository implements the domain.Repository interface for SQLite
func (*SQLiteRepository) AddUser ¶
func (r *SQLiteRepository) AddUser(ctx any, user *domain.User) error
AddUser adds a new user to the database
func (*SQLiteRepository) Close ¶
func (r *SQLiteRepository) Close() error
Close closes the database connection
func (*SQLiteRepository) FindByEmail ¶
FindByEmail looks up a user by email
func (*SQLiteRepository) GetReport ¶
func (r *SQLiteRepository) GetReport(ctx any, params domain.ReportParams) ([]*domain.User, error)
GetReport retrieves users based on the report parameters
func (*SQLiteRepository) UpdateUser ¶
func (r *SQLiteRepository) UpdateUser(ctx any, user *domain.User) error
UpdateUser updates an existing user information (primarily for marking cocktail as redeemed)