model

package
v0.0.0-...-29e355a Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 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 Model

type Model interface {
	GetID() string
}

type Repository

type Repository[T Model] interface {
	// Fetch a single item by its ID
	GetByID(ctx context.Context, id string) (T, error)

	// Fetch multiple items by their IDs
	GetByIDList(ctx context.Context, ids []string) ([]T, error)

	// Create a new item
	Create(ctx context.Context, item T) (*string, error)

	// Save (create or update) an item
	Save(ctx context.Context, item T) error

	// Update an existing item
	Update(ctx context.Context, item T) error

	// Delete an item by its ID
	Delete(ctx context.Context, id string) error

	// Delete multiple items by their IDs
	DeleteList(ctx context.Context, ids []string) error
}

Jump to

Keyboard shortcuts

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