MCPcopy
hub / github.com/pocketbase/pocketbase / NewBaseApp

Function NewBaseApp

core/base.go:199–232  ·  view source on GitHub ↗

NewBaseApp creates and returns a new BaseApp instance configured with the provided arguments. To initialize the app, you need to call `app.Bootstrap()`.

(config BaseAppConfig)

Source from the content-addressed store, hash-verified

197//
198// To initialize the app, you need to call `app.Bootstrap()`.
199func NewBaseApp(config BaseAppConfig) *BaseApp {
200 app := &BaseApp{
201 settings: newDefaultSettings(),
202 store: store.New[string, any](nil),
203 cron: cron.New(),
204 subscriptionsBroker: subscriptions.NewBroker(),
205 config: &config,
206 }
207
208 // apply config defaults
209 if app.config.DBConnect == nil {
210 app.config.DBConnect = DefaultDBConnect
211 }
212 if app.config.DataMaxOpenConns <= 0 {
213 app.config.DataMaxOpenConns = DefaultDataMaxOpenConns
214 }
215 if app.config.DataMaxIdleConns <= 0 {
216 app.config.DataMaxIdleConns = DefaultDataMaxIdleConns
217 }
218 if app.config.AuxMaxOpenConns <= 0 {
219 app.config.AuxMaxOpenConns = DefaultAuxMaxOpenConns
220 }
221 if app.config.AuxMaxIdleConns <= 0 {
222 app.config.AuxMaxIdleConns = DefaultAuxMaxIdleConns
223 }
224 if app.config.QueryTimeout <= 0 {
225 app.config.QueryTimeout = DefaultQueryTimeout
226 }
227
228 app.initHooks()
229 app.registerBaseHooks()
230
231 return app
232}
233
234// initHooks initializes all app hook handlers.
235func (app *BaseApp) initHooks() {

Callers 14

NewWithConfigFunction · 0.92
TestNewBaseAppFunction · 0.92
TestBaseAppBootstrapFunction · 0.92
TestNewBaseAppTxFunction · 0.92
TestBaseAppNewMailClientFunction · 0.92
TestBaseAppNewFilesystemFunction · 0.92
NewTestAppWithConfigFunction · 0.92
TestSendSystemAlertFunction · 0.85

Calls 5

initHooksMethod · 0.95
registerBaseHooksMethod · 0.95
NewFunction · 0.92
NewBrokerFunction · 0.92
newDefaultSettingsFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…