infract internal link

This commit is contained in:
jflyfox 2021-05-21 15:38:56 +08:00
parent 406b6bf410
commit 6d81aa4462
2 changed files with 2 additions and 18 deletions

View File

@ -23,6 +23,7 @@ import (
"github.com/gogf/gf/util/gconv"
)
// GetCore returns the underlying *Core object.
func (c *Core) GetCore() *Core {
return c
}
@ -122,12 +123,6 @@ func (c *Core) GetAll(sql string, args ...interface{}) (Result, error) {
// DoGetAll queries and returns data records from database.
func (c *Core) DoGetAll(ctx context.Context, link Link, sql string, args ...interface{}) (result Result, err error) {
if link == nil {
link, err = c.SlaveLink()
if err != nil {
return nil, err
}
}
rows, err := c.DoQuery(ctx, link, sql, args...)
if err != nil || rows == nil {
return nil, err

View File

@ -24,18 +24,7 @@ import (
//
// Also see DriverMysql.TableFields.
func (m *Model) TableFields(table string, schema ...string) (fields map[string]*TableField, err error) {
var (
link Link
)
if m.tx != nil {
link = &txLink{m.tx.tx}
} else {
link, err = m.db.GetCore().SlaveLink(schema...)
if err != nil {
return
}
}
return m.db.TableFields(m.GetCtx(), link, table, schema...)
return m.db.TableFields(m.GetCtx(), m.getLink(false), table, schema...)
}
// getModel creates and returns a cloned model of current model if `safe` is true, or else it returns