Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenericRepository ¶
type GenericRepository[T interface{}] interface { DB() *gorm.DB GetModel() T Debug() GenericRepository[T] Preload(query string, args ...interface{}) GenericRepository[T] All() ([]T, error) Create(ent T) (*T, error) Update(pk uint, ent T) (*T, error) Save(ent T) (*T, error) Find(pk uint) (*T, error) FindByEntity(ent T) (*T, error) FindByAttribute(attr string, value interface{}) (*T, error) Get(fn func(tx *gorm.DB) (*gorm.DB, error)) ([]T, error) GetByEntity(ent T) ([]T, error) GetByAttributes(attrs map[string]interface{}) ([]T, error) Delete(pk uint) (bool, error) }
func NewGenericRepository ¶
func NewGenericRepository[T interface{}](db *gorm.DB, model T) GenericRepository[T]
Click to show internal directories.
Click to hide internal directories.