Skip to content

Initial#1

Open
syols wants to merge 4 commits intomainfrom
project
Open

Initial#1
syols wants to merge 4 commits intomainfrom
project

Conversation

@syols
Copy link
Owner

@syols syols commented Jan 16, 2023

No description provided.

Copy link

@bambruysk bambruysk left a comment

Choose a reason for hiding this comment

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

Хороший код в целом. Мелкие замечания нужно поправвить

}

func (c URLConnection) Close(db *sqlx.DB) {
defer func(db *sqlx.DB) {

Choose a reason for hiding this comment

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

зачем здесь defer?

return bindUser(rows)
}

func (d *Database) execute(ctx context.Context, filename string, model interface{}) (*sqlx.Rows, error) {

Choose a reason for hiding this comment

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

Для исполнения sql запросов из файла удобнее использовать https://pkg.go.dev/embed - сразу читает файл в строку на этапе компиляции

}
close(errs)
}()
wg.Wait()

Choose a reason for hiding this comment

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

Зачем здесь горутинв если мы ждем ее завершения сразу после запуска?

@@ -0,0 +1,36 @@
CREATE TYPE detail AS ENUM ('TEXT', 'BLOB', 'CARD', 'DETAIL');

CREATE TABLE records (

Choose a reason for hiding this comment

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

лучше использовать IF NOT EXISTS

}

func (r *Record) Validate() error {
return validator.New().Struct(r)

Choose a reason for hiding this comment

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

рекомендуется валидатор делать синглтоном или глобальноу переменной в целях производительности

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