Documentation
¶
Overview ¶
Package store is the single-source comment repository: one implementation against *sql.DB plus a kernel Dialect, replacing the three per-driver copies. Placeholder rendering and RETURNING support come from the dialect; everything else (columns, scans, messages, guards) ports the SQLite implementation verbatim, which the moved test suite pins.
Index ¶
- type CommentItem
- type Repository
- func (r *Repository) Count(ctx context.Context, userID int) (int, error)
- func (r *Repository) Create(ctx context.Context, comment *commentdomain.Comment) error
- func (r *Repository) Delete(ctx context.Context, id int) error
- func (r *Repository) DeleteByUserID(ctx context.Context, userID int) error
- func (r *Repository) GetByContentID(ctx context.Context, contentID int) ([]*commentdomain.Comment, error)
- func (r *Repository) GetByContentIDForModeration(ctx context.Context, contentID int) ([]*commentdomain.Comment, error)
- func (r *Repository) GetByID(ctx context.Context, id int) (*commentdomain.Comment, error)
- func (r *Repository) GetByStatus(ctx context.Context, status commentdomain.CommentStatus) ([]*commentdomain.Comment, error)
- func (r *Repository) GetByUserID(ctx context.Context, userID int) ([]*commentdomain.Comment, error)
- func (r *Repository) UpdateStatus(ctx context.Context, id int, status commentdomain.CommentStatus) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommentItem ¶
type CommentItem struct {
ID int `json:"id"`
ContentID int `json:"contentId"`
UserID int `json:"userId"`
Comment string `json:"comment"`
Status string `json:"status"`
Author sql.NullString `json:"author"`
Username sql.NullString `json:"username"`
Role sql.NullString `json:"role"`
ContentTitle sql.NullString `json:"contentTitle"`
ContentSlug sql.NullString `json:"contentSlug"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
CommentItem represents a comment in the database
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository implements commentdomain.CommentRepository for every driver.
func New ¶
func New(db *sql.DB, dialect kerneldatabase.Dialect) *Repository
New creates a repository on db speaking dialect. Dialect must be non-nil; the composition root resolves it from the driver registry.
func (*Repository) Create ¶
func (r *Repository) Create(ctx context.Context, comment *commentdomain.Comment) error
func (*Repository) DeleteByUserID ¶
func (r *Repository) DeleteByUserID(ctx context.Context, userID int) error
func (*Repository) GetByContentID ¶
func (r *Repository) GetByContentID(ctx context.Context, contentID int) ([]*commentdomain.Comment, error)
func (*Repository) GetByContentIDForModeration ¶
func (r *Repository) GetByContentIDForModeration(ctx context.Context, contentID int) ([]*commentdomain.Comment, error)
func (*Repository) GetByID ¶
func (r *Repository) GetByID(ctx context.Context, id int) (*commentdomain.Comment, error)
func (*Repository) GetByStatus ¶
func (r *Repository) GetByStatus(ctx context.Context, status commentdomain.CommentStatus) ([]*commentdomain.Comment, error)
func (*Repository) GetByUserID ¶
func (r *Repository) GetByUserID(ctx context.Context, userID int) ([]*commentdomain.Comment, error)
func (*Repository) UpdateStatus ¶
func (r *Repository) UpdateStatus(ctx context.Context, id int, status commentdomain.CommentStatus) error