Documentation ¶
Index ¶
- type SimplyRepository
- func (r *SimplyRepository[T]) Create(data T) (uuid.UUID, error)
- func (r *SimplyRepository[T]) Delete(id uuid.UUID) (int64, error)
- func (r *SimplyRepository[T]) FindAll(mapFields map[string]any) ([]T, error)
- func (r *SimplyRepository[T]) Read(id uuid.UUID) (T, error)
- func (r *SimplyRepository[T]) ReadAll() ([]T, error)
- func (r *SimplyRepository[T]) Update(id uuid.UUID, mapFields map[string]any) (int64, error)
- type SimplyRepositoryInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SimplyRepository ¶
func (*SimplyRepository[T]) Create ¶
func (r *SimplyRepository[T]) Create(data T) (uuid.UUID, error)
Create is a generic method for create operation @param data - pointer to entity @return uuid of created entity, error
func (*SimplyRepository[T]) Delete ¶
func (r *SimplyRepository[T]) Delete(id uuid.UUID) (int64, error)
func (*SimplyRepository[T]) FindAll ¶
func (r *SimplyRepository[T]) FindAll(mapFields map[string]any) ([]T, error)
func (*SimplyRepository[T]) ReadAll ¶
func (r *SimplyRepository[T]) ReadAll() ([]T, error)
type SimplyRepositoryInterface ¶
type SimplyRepositoryInterface[T easywalk.SimplyEntityInterface] interface { Create(data T) (uuid.UUID, error) Update(id uuid.UUID, mapFields map[string]any) (int64, error) Delete(id uuid.UUID) (int64, error) // Query Read(id uuid.UUID) (T, error) ReadAll() ([]T, error) FindAll(mapFields map[string]any) ([]T, error) }
func NewRepository ¶ added in v1.0.14
func NewRepository[T easywalk.SimplyEntityInterface](db *gorm.DB) SimplyRepositoryInterface[T]
NewSimplyRepository is a factory method for create new simplyRepository @param db - pointer to gorm DB @return pointer to simplyRepository @example
repo := NewSimplyRepository(db)
Click to show internal directories.
Click to hide internal directories.