mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 12:14:08 -06:00
572e5a76ef
* add xorm and xorm/core as package * remove mssql and oracle as driver * fix some typo * remove unittest * remove some cache * restore the removed part * remove logfile
32 lines
700 B
Go
32 lines
700 B
Go
// Copyright 2020 The Xorm Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package xorm
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"xorm.io/core"
|
|
)
|
|
|
|
func getTableName(mapper core.IMapper, v reflect.Value) string {
|
|
if t, ok := v.Interface().(TableName); ok {
|
|
return t.TableName()
|
|
}
|
|
if v.Type().Implements(tpTableName) {
|
|
return v.Interface().(TableName).TableName()
|
|
}
|
|
if v.Kind() == reflect.Ptr {
|
|
v = v.Elem()
|
|
if t, ok := v.Interface().(TableName); ok {
|
|
return t.TableName()
|
|
}
|
|
if v.Type().Implements(tpTableName) {
|
|
return v.Interface().(TableName).TableName()
|
|
}
|
|
}
|
|
|
|
return mapper.Obj2Table(v.Type().Name())
|
|
}
|