MCPcopy Index your code
hub / github.com/apache/answer / initDatabase

Function initDatabase

plugin/plugin_test/plugin_main_test.go:181–199  ·  view source on GitHub ↗
(dbSetting TestDBSetting)

Source from the content-addressed store, hash-verified

179}
180
181func initDatabase(dbSetting TestDBSetting) (dbEngine *xorm.Engine, err error) {
182 dataConf := &data.Database{Driver: dbSetting.Driver, Connection: dbSetting.Connection}
183 dbEngine, err = data.NewDB(true, dataConf)
184 if err != nil {
185 return nil, fmt.Errorf("connection to database failed: %s", err)
186 }
187 if err := migrations.NewMentor(context.TODO(), dbEngine, &migrations.InitNeedUserInputData{
188 Language: "en_US",
189 SiteName: "ANSWER",
190 SiteURL: "http://127.0.0.1:8080/",
191 ContactEmail: "answer@answer.com",
192 AdminName: "admin",
193 AdminPassword: "admin",
194 AdminEmail: "answer@answer.com",
195 }).InitDB(); err != nil {
196 return nil, fmt.Errorf("migrations init database failed: %s", err)
197 }
198 return dbEngine, nil
199}
200
201func initCache() (newCache cache.Cache, err error) {
202 newCache, _, err = data.NewCache(&data.CacheConf{})

Callers 1

initTestDataSourceFunction · 0.70

Calls 3

NewDBFunction · 0.92
NewMentorFunction · 0.92
InitDBMethod · 0.80

Tested by

no test coverage detected