Documentation
¶
Index ¶
- type GormTransactional
- type OrmQuery
- type OrmQueryFunc
- type OrmRepository
- func (this *OrmRepository[T, ID]) Delete(object *T) Error
- func (this *OrmRepository[T, ID]) DeleteById(id ID) Error
- func (this *OrmRepository[T, ID]) FindById(id ID) Optional[*T]
- func (this *OrmRepository[T, ID]) PostConstruct(parent any) Error
- func (this *OrmRepository[T, ID]) Query(queries ...OrmQueryFunc) *gorm.DB
- func (this *OrmRepository[T, ID]) Save(object *T) (*T, Error)
- func (this *OrmRepository[T, ID]) SaveAll(objects []*T) ([]*T, Error)
- type OrmRepositoryInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormTransactional ¶
GormTransactional represent the interface of a Transactional gorm.DB
type OrmQuery ¶
type OrmQuery interface {
Query(args ...any) OrmQueryFunc
}
type OrmRepository ¶
type OrmRepository[T any, K comparable] struct { Repository // contains filtered or unexported fields }
func (*OrmRepository[T, ID]) Delete ¶
func (this *OrmRepository[T, ID]) Delete(object *T) Error
func (*OrmRepository[T, ID]) DeleteById ¶
func (this *OrmRepository[T, ID]) DeleteById(id ID) Error
func (*OrmRepository[T, ID]) FindById ¶
func (this *OrmRepository[T, ID]) FindById(id ID) Optional[*T]
func (*OrmRepository[T, ID]) PostConstruct ¶
func (this *OrmRepository[T, ID]) PostConstruct(parent any) Error
func (*OrmRepository[T, ID]) Query ¶
func (this *OrmRepository[T, ID]) Query(queries ...OrmQueryFunc) *gorm.DB
func (*OrmRepository[T, ID]) Save ¶
func (this *OrmRepository[T, ID]) Save(object *T) (*T, Error)
func (*OrmRepository[T, ID]) SaveAll ¶
func (this *OrmRepository[T, ID]) SaveAll(objects []*T) ([]*T, Error)
type OrmRepositoryInterface ¶
type OrmRepositoryInterface[T any, K comparable] interface { // Query() lets you execute queries on <T>, calling gorm Model() *gorm.DB first. Query(queries ...OrmQueryFunc) *gorm.DB // FindById() lets you find an optional model pointer by its Id or type <ID>. FindById(id K) Optional[*T] // Delete() lets you delete a model <T> pointer, previously returned. Delete(object *T) Error // DeleteById() lets you delete a model using its id of type <ID>. DeleteById(id K) Error // Save() saves a model <T> pointer, returning the pointer and/or an Error. Save(object *T) (*T, Error) // SaveAll saves a slice of <T> pointers, returning it and/or an Error. SaveAll(object []*T) ([]*T, Error) }
Click to show internal directories.
Click to hide internal directories.