Documentation ¶
Index ¶
- type Database
- type DatabaseOption
- type NotificationRepository
- func (r *NotificationRepository) Create(ctx context.Context, notification *model.Notification) error
- func (r *NotificationRepository) Delete(ctx context.Context, id, recipient model.ID) error
- func (r *NotificationRepository) Get(ctx context.Context, id, recipient model.ID) (*model.Notification, error)
- func (r *NotificationRepository) GetAllByRecipient(ctx context.Context, recipient model.ID, offset, limit int) ([]*model.Notification, error)
- func (r *NotificationRepository) Update(ctx context.Context, id, recipient model.ID, read bool) (*model.Notification, error)
- type Pool
- type RepositoryOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database represents a Postgres database, wrapping a postgres connection.
func NewDatabase ¶
func NewDatabase(opts ...DatabaseOption) (*Database, error)
NewDatabase creates a new Postgres database.
type DatabaseOption ¶
DatabaseOption configures a Postgres database.
func WithDatabaseLogger ¶
func WithDatabaseLogger(logger log.Logger) DatabaseOption
WithDatabaseLogger sets the logger for a Neo4j database.
func WithDatabasePool ¶
func WithDatabasePool(pool Pool) DatabaseOption
WithDatabasePool sets the pool for a Postgres database.
func WithDatabaseTracer ¶
func WithDatabaseTracer(tracer tracing.Tracer) DatabaseOption
WithDatabaseTracer sets the tracer for a Neo4j database.
type NotificationRepository ¶
type NotificationRepository struct {
// contains filtered or unexported fields
}
NotificationRepository is a repository for managing notifications.
func NewNotificationRepository ¶
func NewNotificationRepository(opts ...RepositoryOption) (*NotificationRepository, error)
NewNotificationRepository creates a new NotificationRepository.
func (*NotificationRepository) Create ¶
func (r *NotificationRepository) Create(ctx context.Context, notification *model.Notification) error
func (*NotificationRepository) Get ¶
func (r *NotificationRepository) Get(ctx context.Context, id, recipient model.ID) (*model.Notification, error)
func (*NotificationRepository) GetAllByRecipient ¶
func (r *NotificationRepository) GetAllByRecipient(ctx context.Context, recipient model.ID, offset, limit int) ([]*model.Notification, error)
type Pool ¶
type Pool interface { Close() Acquire(ctx context.Context) (*pgxpool.Conn, error) AcquireFunc(ctx context.Context, f func(*pgxpool.Conn) error) error AcquireAllIdle(ctx context.Context) []*pgxpool.Conn Reset() Config() *pgxpool.Config Stat() *pgxpool.Stat Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults Begin(ctx context.Context) (pgx.Tx, error) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) Ping(ctx context.Context) error }
Pool defines the interface for a database connection pool.
type RepositoryOption ¶
type RepositoryOption func(*baseRepository) error
func WithDatabase ¶
func WithDatabase(db *Database) RepositoryOption
WithDatabase sets the baseRepository for a baseRepository.
func WithRepositoryLogger ¶
func WithRepositoryLogger(logger log.Logger) RepositoryOption
WithRepositoryLogger sets the logger for a baseRepository.
func WithRepositoryTracer ¶
func WithRepositoryTracer(tracer tracing.Tracer) RepositoryOption
WithRepositoryTracer sets the tracer for a baseRepository.