MCPcopy
hub / github.com/gogf/gf / GetCtx

Method GetCtx

database/gdb/gdb_model.go:223–228  ·  view source on GitHub ↗

GetCtx returns the context for current Model. It returns `context.Background()` is there's no context previously set.

()

Source from the content-addressed store, hash-verified

221// GetCtx returns the context for current Model.
222// It returns `context.Background()` is there's no context previously set.
223func (m *Model) GetCtx() context.Context {
224 if m.tx != nil && m.tx.GetCtx() != nil {
225 return m.tx.GetCtx()
226 }
227 return m.db.GetCtx()
228}
229
230// As sets an alias name for current table.
231func (m *Model) As(as string) *Model {

Callers 15

TransactionMethod · 0.95
AllMethod · 0.95
AllAndCountMethod · 0.95
OneMethod · 0.95
ArrayMethod · 0.95
ValueMethod · 0.95
CountMethod · 0.95
DeleteMethod · 0.95
InsertMethod · 0.95
InsertAndGetIdMethod · 0.95
InsertIgnoreMethod · 0.95

Calls 1

GetCtxMethod · 0.65

Tested by

no test coverage detected