repository

package
v0.0.0-...-6ba0ecf Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPersonRepository

type IPersonRepository interface {
	Create(person *model.Person) (*model.Person, error)
	Delete(personId uint) (*model.Person, error)
	FindAll() ([]model.Person, error)
	GetByID(personId uint) (*model.Person, error)
}

IPersonRepository defines the interface for person repository operations.

func NewPersonRepository

func NewPersonRepository(db *gorm.DB) IPersonRepository

NewPersonRepository creates a new instance of PersonRepository.

type PersonRepository

type PersonRepository struct {
	Db *gorm.DB
}

PersonRepository implements the IPersonRepository interface.

func (*PersonRepository) Create

func (r *PersonRepository) Create(person *model.Person) (*model.Person, error)

Create inserts a new person record into the database.

func (*PersonRepository) Delete

func (r *PersonRepository) Delete(personId uint) (*model.Person, error)

Delete removes a person record from the database by its ID.

func (*PersonRepository) FindAll

func (r *PersonRepository) FindAll() ([]model.Person, error)

FindAll retrieves all person records from the database.

func (*PersonRepository) GetByID

func (r *PersonRepository) GetByID(personId uint) (*model.Person, error)

GetByID retrieves a person record by its ID.

Jump to

Keyboard shortcuts

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