mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 01:01:56 +00:00
fix reflection
This commit is contained in:
parent
00b9c3156f
commit
82501ff57c
|
@ -1,6 +1,6 @@
|
|||
-- +up
|
||||
-- +begin
|
||||
ALTER TABLE `trades` ADD COLUMN `inserted_at` DATETIME(3) DEFAULT CURRENT_TIMESTAMP NOT NULL AFTER `traded_at`;
|
||||
ALTER TABLE `trades` ADD COLUMN `inserted_at` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL AFTER `traded_at`;
|
||||
-- +end
|
||||
|
||||
-- +begin
|
||||
|
|
|
@ -27,13 +27,16 @@ func tableNameOf(record interface{}) string {
|
|||
}
|
||||
|
||||
func placeholdersOf(record interface{}) []string {
|
||||
vt := reflect.ValueOf(record)
|
||||
rt := reflect.TypeOf(record)
|
||||
|
||||
if rt.Kind() == reflect.Ptr {
|
||||
rt = rt.Elem()
|
||||
}
|
||||
|
||||
vt := reflect.ValueOf(record)
|
||||
if vt.Kind() == reflect.Ptr {
|
||||
vt = vt.Elem()
|
||||
}
|
||||
|
||||
if rt.Kind() != reflect.Struct {
|
||||
return nil
|
||||
}
|
||||
|
@ -60,13 +63,16 @@ func placeholdersOf(record interface{}) []string {
|
|||
}
|
||||
|
||||
func fieldsNamesOf(record interface{}) []string {
|
||||
vt := reflect.ValueOf(record)
|
||||
rt := reflect.TypeOf(record)
|
||||
|
||||
if rt.Kind() == reflect.Ptr {
|
||||
rt = rt.Elem()
|
||||
}
|
||||
|
||||
vt := reflect.ValueOf(record)
|
||||
if vt.Kind() == reflect.Ptr {
|
||||
vt = vt.Elem()
|
||||
}
|
||||
|
||||
if rt.Kind() != reflect.Struct {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user