MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / initDB

Function initDB

cmd/cql-proxy/init.go:81–101  ·  view source on GitHub ↗
(e *gin.Engine, cfg *config.Config)

Source from the content-addressed store, hash-verified

79}
80
81func initDB(e *gin.Engine, cfg *config.Config) (st *gorp.DbMap, err error) {
82 st, err = storage.NewDatabase(cfg.Storage)
83 if err != nil {
84 return
85 }
86
87 // add tables
88 model.AddTables(st)
89
90 // create table if not exists
91 if err = st.CreateTablesIfNotExists(); err != nil {
92 return
93 }
94
95 e.Use(func(c *gin.Context) {
96 c.Set("db", st)
97 c.Next()
98 })
99
100 return
101}
102
103func initAuth(e *gin.Engine, cfg *config.Config) (authz *auth.AdminAuth) {
104 authz = auth.NewAdminAuth(cfg.AdminAuth)

Callers 1

initServerFunction · 0.85

Calls 4

NewDatabaseFunction · 0.92
AddTablesFunction · 0.92
SetMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected