1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-03 16:20:19 +00:00

orm full remove orm.Manager for simple use, add struct tag - for skip struct field

This commit is contained in:
slene
2013-08-09 20:14:18 +08:00
parent 402932aa6e
commit f2b359d8e8
16 changed files with 161 additions and 301 deletions

View File

@ -7,8 +7,11 @@ import (
"time"
)
func getTableName(model Modeler) string {
val := reflect.ValueOf(model)
func getFullName(typ reflect.Type) string {
return typ.PkgPath() + "." + typ.Name()
}
func getTableName(val reflect.Value) string {
ind := reflect.Indirect(val)
fun := val.MethodByName("TableName")
if fun.IsValid() {
@ -23,11 +26,6 @@ func getTableName(model Modeler) string {
return snakeString(ind.Type().Name())
}
func getPkgPath(model Modeler) string {
val := reflect.ValueOf(model)
return val.Type().Elem().PkgPath()
}
func getColumnName(ft int, addrField reflect.Value, sf reflect.StructField, col string) string {
column := strings.ToLower(col)
if column == "" {