Documentation
¶
Index ¶
- type PersistenceDB
- type PostgresRepo
- func (ps *PostgresRepo) Close()
- func (ps *PostgresRepo) CreateComment(ctx context.Context, comment models.Comment) (string, error)
- func (ps *PostgresRepo) CreateLike(ctx context.Context, like models.Like) error
- func (ps *PostgresRepo) CreatePost(ctx context.Context, post models.Post) (string, error)
- func (ps *PostgresRepo) DeleteComment(ctx context.Context, id string) error
- func (ps *PostgresRepo) DeleteLike(ctx context.Context, post_id string, userId string) error
- func (ps *PostgresRepo) DeletePost(ctx context.Context, id string) error
- func (ps *PostgresRepo) GetComments(ctx context.Context, id string) ([]models.Comment, error)
- func (ps *PostgresRepo) GetCounters(ctx context.Context, ids []string) ([]models.CachedCounter, error)
- func (ps *PostgresRepo) GetLikes(ctx context.Context, id string) ([]models.Like, error)
- func (ps *PostgresRepo) GetPosts(ctx context.Context, ids []string) ([]models.Post, error)
- func (ps *PostgresRepo) UpdateCounters(ctx context.Context, counters []models.CachedCounter) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PersistenceDB ¶
type PersistenceDB interface {
CreatePost(ctx context.Context, post models.Post) (string, error)
DeletePost(ctx context.Context, id string) error
GetPosts(ctx context.Context, ids []string) ([]models.Post, error)
CreateComment(ctx context.Context, comment models.Comment) (string, error)
CreateLike(ctx context.Context, like models.Like) error
DeleteComment(ctx context.Context, id string) error
DeleteLike(ctx context.Context, post_id string, userId string) error
GetComments(ctx context.Context, id string) ([]models.Comment, error)
GetLikes(ctx context.Context, id string) ([]models.Like, error)
GetCounters(ctx context.Context, ids []string) ([]models.CachedCounter, error)
UpdateCounters(ctx context.Context, counters []models.CachedCounter) error
Close()
}
type PostgresRepo ¶
type PostgresRepo struct {
// contains filtered or unexported fields
}
func NewPostgresRepo ¶
func NewPostgresRepo(primaryDB, replicaDB *sql.DB) *PostgresRepo
func (*PostgresRepo) Close ¶
func (ps *PostgresRepo) Close()
func (*PostgresRepo) CreateComment ¶
func (*PostgresRepo) CreateLike ¶
func (*PostgresRepo) CreatePost ¶
Write operations use primaryDB
func (*PostgresRepo) DeleteComment ¶
func (ps *PostgresRepo) DeleteComment(ctx context.Context, id string) error
func (*PostgresRepo) DeleteLike ¶
func (*PostgresRepo) DeletePost ¶
func (ps *PostgresRepo) DeletePost(ctx context.Context, id string) error
func (*PostgresRepo) GetComments ¶
func (*PostgresRepo) GetCounters ¶
func (ps *PostgresRepo) GetCounters(ctx context.Context, ids []string) ([]models.CachedCounter, error)
func (*PostgresRepo) UpdateCounters ¶
func (ps *PostgresRepo) UpdateCounters(ctx context.Context, counters []models.CachedCounter) error
Write operation - uses primaryDB
Click to show internal directories.
Click to hide internal directories.