some fixes
This commit is contained in:
parent
c1e8922968
commit
9fe21b4b78
3 changed files with 60 additions and 30 deletions
|
|
@ -14,7 +14,7 @@ type MerchRepo interface {
|
|||
createMerch(ctx context.Context, merch *Merch, extra []ExtraData) error
|
||||
|
||||
// getMany returns list of only main merch record, without origins extra data
|
||||
getMany(ctx context.Context, userId int64) ([]merchDTO, error)
|
||||
getMany(ctx context.Context, userId int64) ([]getMerchInternal, error)
|
||||
|
||||
getMerchIdByUuid(ctx context.Context, userId int64, uuid string) (int64, error)
|
||||
getMerchUuidMap(ctx context.Context, merchUuids []string) (map[string]int64, error)
|
||||
|
|
@ -75,8 +75,8 @@ func (r *repo) createMerch(ctx context.Context, merch *Merch, extra []ExtraData)
|
|||
return tx.Commit(ctx)
|
||||
}
|
||||
|
||||
func (r *repo) getMany(ctx context.Context, userId int64) ([]merchDTO, error) {
|
||||
q := `SELECT created_at, updated_at, merch_uuid, name FROM merch WHERE deleted_at IS NULL AND user_id = $1`
|
||||
func (r *repo) getMany(ctx context.Context, userId int64) ([]getMerchInternal, error) {
|
||||
q := `SELECT id, merch_uuid, name FROM merch WHERE deleted_at IS NULL AND user_id = $1`
|
||||
|
||||
rows, err := r.db.Query(ctx, q, userId)
|
||||
if err != nil {
|
||||
|
|
@ -84,10 +84,10 @@ func (r *repo) getMany(ctx context.Context, userId int64) ([]merchDTO, error) {
|
|||
}
|
||||
defer rows.Close()
|
||||
|
||||
var result []merchDTO
|
||||
var result []getMerchInternal
|
||||
for rows.Next() {
|
||||
var m merchDTO
|
||||
if err = rows.Scan(&m.CreatedAt, &m.UpdatedAt, &m.MerchUuid, &m.Name); err != nil {
|
||||
var m getMerchInternal
|
||||
if err = rows.Scan(&m.Id, &m.MerchUuid, &m.Name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result = append(result, m)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue