Documentation
¶
Overview ¶
Base repository package
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseRepository ¶
BaseRepository provides common database functionality
func NewBaseRepository ¶
func NewBaseRepository(db *ent.Client) *BaseRepository
NewBaseRepository creates a new repository
func (*BaseRepository) WithTx ¶
func (r *BaseRepository) WithTx(ctx context.Context, fn func(tx TxInterface) error) error
WithTx runs a function in a transaction Usage example:
if err := r.WithTx(func(tx *ent.Tx) error { Do stuff with tx return nil }); err != nil { Handle error }
type BaseRepositoryInterface ¶
type BaseRepositoryInterface interface { // WithTx runs a function in a transaction // Usage example: // // if err := r.WithTx(func(tx *ent.Tx) error { // Do stuff with tx // return nil // }); err != nil { // // Handle error // } WithTx(ctx context.Context, fn func(tx TxInterface) error) error }
BaseRepositoryInterface ...
Click to show internal directories.
Click to hide internal directories.