package orm
import (
)
type TableModel interface {
Model
IsNil() bool
Table() *Table
Relation() *Relation
AppendParam(QueryFormatter, []byte, string) ([]byte, bool)
Join(string, func(*Query) (*Query, error)) *join
GetJoin(string) *join
GetJoins() []join
AddJoin(join) *join
Root() reflect.Value
Index() []int
ParentIndex() []int
Mount(reflect.Value)
Kind() reflect.Kind
Value() reflect.Value
setSoftDeleteField() error
scanColumn(types.ColumnInfo, types.Reader, int) (bool, error)
}
func ( reflect.Type, reflect.Value, []int, *Relation) (TableModel, error) {
= typeByIndex(, )
if .Kind() == reflect.Struct {
return &structTableModel{
table: GetTable(),
rel: ,
root: ,
index: ,
}, nil
}
if .Kind() == reflect.Slice {
:= indirectType(.Elem())
if .Kind() == reflect.Struct {
:= sliceTableModel{
structTableModel: structTableModel{
table: GetTable(),
rel: ,
root: ,
index: ,
},
}
.init()
return &, nil
}
}
return nil, fmt.Errorf("pg: NewModel(%s)", )
}