-
Notifications
You must be signed in to change notification settings - Fork 73
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
Use reflection to set PK #266
Conversation
querier_commands.go
Outdated
@@ -94,7 +94,7 @@ func (q *Querier) insert(str Struct, columns []string, values []interface{}) err | |||
if err != nil { | |||
return err | |||
} | |||
record.SetPK(id) | |||
record.SetPK(id) // TODO optimize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
querier_commands.go:97: Line contains TODO/BUG/FIXME: "TODO optimize" (godox)
t.Parallel() | ||
|
||
var person Person | ||
person.SetPK(int32(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: person.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
var person Person | ||
person.SetPK(int32(1)) | ||
assert.EqualValues(t, 1, person.ID) | ||
person.SetPK(int64(2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: person.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
assert.EqualValues(t, 1, person.ID) | ||
person.SetPK(int64(2)) | ||
assert.EqualValues(t, 2, person.ID) | ||
person.SetPK(Integer(3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: person.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
assert.EqualValues(t, 3, person.ID) | ||
|
||
var project Project | ||
project.SetPK("baron") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: project.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
var project Project | ||
project.SetPK("baron") | ||
assert.EqualValues(t, "baron", project.ID) | ||
project.SetPK(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: project.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
assert.EqualValues(t, "baron", project.ID) | ||
|
||
var extra Extra | ||
extra.SetPK(int32(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: extra.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
var extra Extra | ||
extra.SetPK(int32(1)) | ||
assert.EqualValues(t, 1, extra.ID) | ||
extra.SetPK(int64(2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: extra.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
assert.EqualValues(t, 1, extra.ID) | ||
extra.SetPK(int64(2)) | ||
assert.EqualValues(t, 2, extra.ID) | ||
extra.SetPK(Integer(3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: extra.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
querier_commands.go
Outdated
@@ -94,7 +94,7 @@ func (q *Querier) insert(str Struct, columns []string, values []interface{}) err | |||
if err != nil { | |||
return err | |||
} | |||
record.SetPK(id) | |||
record.SetPK(id) // TODO optimize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
querier_commands.go:97: Line contains TODO/BUG/FIXME: "TODO optimize" (godox)
t.Parallel() | ||
|
||
var person Person | ||
person.SetPK(int32(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: person.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
var person Person | ||
person.SetPK(int32(1)) | ||
assert.EqualValues(t, 1, person.ID) | ||
person.SetPK(int64(2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: person.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
assert.EqualValues(t, 1, person.ID) | ||
person.SetPK(int64(2)) | ||
assert.EqualValues(t, 2, person.ID) | ||
person.SetPK(Integer(3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: person.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
assert.EqualValues(t, 3, person.ID) | ||
|
||
var project Project | ||
project.SetPK("baron") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: project.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
var project Project | ||
project.SetPK("baron") | ||
assert.EqualValues(t, "baron", project.ID) | ||
project.SetPK(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: project.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
assert.EqualValues(t, "baron", project.ID) | ||
|
||
var extra Extra | ||
extra.SetPK(int32(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: extra.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
var extra Extra | ||
extra.SetPK(int32(1)) | ||
assert.EqualValues(t, 1, extra.ID) | ||
extra.SetPK(int64(2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: extra.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
assert.EqualValues(t, 1, extra.ID) | ||
extra.SetPK(int64(2)) | ||
assert.EqualValues(t, 2, extra.ID) | ||
extra.SetPK(Integer(3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
SA1019: extra.SetPK is deprecated: prefer direct field assignment where possible: s.ID = pk. (staticcheck)
@@ -94,7 +94,9 @@ func (q *Querier) insert(str Struct, columns []string, values []interface{}) err | |||
if err != nil { | |||
return err | |||
} | |||
record.SetPK(id) | |||
|
|||
// TODO optimize to avoid using reflection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Optional linters] reported by reviewdog 🐶
querier_commands.go:98: Line contains TODO/BUG/FIXME: "TODO optimize to avoid using reflection" (godox)
Closes #245.