repository

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository[T any, K comparable] interface {
	// Save creates or updates an entity.
	Save(ctx context.Context, entity T) (T, error)
	// FindByID retrieves an entity by its ID.
	FindByID(ctx context.Context, id K) (T, error)
	// FindAll retrieves all entities.
	FindAll(ctx context.Context) ([]T, error)
	// DeleteByID deletes an entity by its ID.
	DeleteByID(ctx context.Context, id K) error
	// ExistsByID checks if an entity with the given ID exists.
	ExistsByID(ctx context.Context, id K) (bool, error)
}

Repository is a generic interface for basic CRUD operations on an entity. T is the type of the entity, K is the type of the entity's ID.

Jump to

Keyboard shortcuts

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