repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRepo

type BaseRepo[T any] struct {
	DB *gorm.DB
}

func NewBaseRepo

func NewBaseRepo[T any](db *gorm.DB) *BaseRepo[T]

func (*BaseRepo[T]) Create

func (repo *BaseRepo[T]) Create(ctx context.Context, entity T) (T, error)

func (*BaseRepo[T]) Delete

func (repo *BaseRepo[T]) Delete(ctx context.Context, id interface{}) error

func (*BaseRepo[T]) Get

func (repo *BaseRepo[T]) Get(ctx context.Context, id interface{}) (T, error)

func (*BaseRepo[T]) Update

func (repo *BaseRepo[T]) Update(ctx context.Context, entity T) error

type UserRepo

type UserRepo struct {
	*BaseRepo[entity.UserEntity]
}

func NewUserRepo

func NewUserRepo(db *gorm.DB) *UserRepo

func (*UserRepo) DeleteById

func (r *UserRepo) DeleteById(ctx context.Context, c entity.UserEntity) error

func (*UserRepo) GetById

Jump to

Keyboard shortcuts

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