store

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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) Count

func (r *Repository) Count(ctx context.Context, userID int) (int, error)

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, comment *commentdomain.Comment) error

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, id int) 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL