feat: added db transactions abstraction; cleaned up user registration; repos adapted new abstraction: all repos now support transactions, if present in ctx
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package repository
|
||||
|
||||
import "database/sql"
|
||||
|
||||
type Store struct {
|
||||
*Transactor
|
||||
Auth *AuthRepo
|
||||
Invite *InviteRepo
|
||||
List *ListRepo
|
||||
User *UserRepo
|
||||
}
|
||||
|
||||
func NewStore(db *sql.DB) *Store {
|
||||
t := NewTransactor(db)
|
||||
r := NewRepo(t)
|
||||
return &Store{
|
||||
Transactor: t,
|
||||
Auth: &AuthRepo{r},
|
||||
Invite: &InviteRepo{r},
|
||||
List: &ListRepo{r},
|
||||
User: &UserRepo{r},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user