Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/async #1

Merged
merged 23 commits into from
Oct 1, 2023
Merged

Feature/async #1

merged 23 commits into from
Oct 1, 2023

Conversation

MarkCherepovskyi
Copy link
Member

No description provided.

type: array
items:
$ref: '#/components/schemas/User'
status:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good practice to make status as enum, but not necessary to change now

db *pgdb.DB
sql sq.SelectBuilder
}

func (q *ClientQ) New() data.ClientQ {
q.mx.Lock()
defer q.mx.Unlock()
return NewClientQ(q.db)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return NewClientQ(q.db.Clone())

err := q.db.Exec(stmt)

return err
err := q.db.Exec(sq.Update(clientTableName).SetMap(clauses).Where(sq.Eq{"id": client.ID}))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where should be moved and you should make separate builders(like selectBuilder + updateBuilder)

if err != nil {
return errors.Wrap(err, "failed to update client")
}
return nil
}

func (q *ClientQ) Insert(value *data.Client) (int64, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you return int64 here?

db *pgdb.DB
sql sq.SelectBuilder
}

func (q *TemplateQ) New() data.TemplateQ {
q.mx.Lock()
defer q.mx.Unlock()
return NewTemplateQ(q.db)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q.db.Clone() here too

return nil, errors.Wrap(err, "failed ot create file")
}

defer os.Remove(fileOutput.Name())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2

templateImg := config.templates[data.Course]

if backgroundImg == nil {
template, err := masterQ.TemplateQ().GetByName(templateImg, userID)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1

return nil, "", nil, errors.Wrap(err, "failed to get background img")
}
if template == nil {
template, err = masterQ.TemplateQ().GetByName(templateImg, userID)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2

@@ -0,0 +1,234 @@
package pdf

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor it a little bit

select {
case <-ctx.Done():
return
case container := <-p.handlerChan:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe would be better to close channel too

@MarkCherepovskyi MarkCherepovskyi merged commit 507221d into demo Oct 1, 2023
1 check passed
@MarkCherepovskyi MarkCherepovskyi deleted the feature/async branch October 1, 2023 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants