mirror of
https://github.com/emo2007/block-accounting.git
synced 2025-04-12 08:56:28 +00:00
tmp
This commit is contained in:
parent
3644ac7c9f
commit
9f28b4bcba
@ -3,8 +3,10 @@ package users
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/emochka2007/block-accounting/internal/pkg/models"
|
"github.com/emochka2007/block-accounting/internal/pkg/models"
|
||||||
|
sqltools "github.com/emochka2007/block-accounting/internal/pkg/sqlutils"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,11 +30,21 @@ type repositorySQL struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewRepository(db *sql.DB) Repository {
|
func NewRepository(db *sql.DB) Repository {
|
||||||
return nil
|
return &repositorySQL{
|
||||||
|
db: db,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repositorySQL) Get(ctx context.Context, params GetParams) (*models.User, error) {
|
func (r *repositorySQL) Get(ctx context.Context, params GetParams) (*models.User, error) {
|
||||||
|
var user *models.User
|
||||||
|
|
||||||
|
if err := sqltools.Transaction(ctx, r.db, func(ctx context.Context) error {
|
||||||
|
return nil
|
||||||
|
}); err != nil {
|
||||||
|
return nil, fmt.Errorf("error execute transactional operation. %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repositorySQL) Create(ctx context.Context, user *models.User) error {
|
func (r *repositorySQL) Create(ctx context.Context, user *models.User) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user