mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-04 11:25:52 +08:00

* feat: added license manager and feature flags * feat: completed org domain api * chore: checking in saml auth handler code * feat: added signup with sso * feat: added login support for admins * feat: added pem support for certificate * ci(build-workflow): 👷 include EE query-service * fix: 🐛 update package name * chore(ee): 🔧 LD_FLAGS related changes Signed-off-by: Prashant Shahi <prashant@signoz.io> Co-authored-by: Prashant Shahi <prashant@signoz.io> Co-authored-by: nityanandagohain <nityanandagohain@gmail.com>
39 lines
649 B
Go
39 lines
649 B
Go
package dao
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/pkg/errors"
|
|
"go.signoz.io/signoz/pkg/query-service/dao/sqlite"
|
|
)
|
|
|
|
var db ModelDao
|
|
|
|
func InitDao(engine, path string) error {
|
|
var err error
|
|
|
|
switch engine {
|
|
case "sqlite":
|
|
db, err = sqlite.InitDB(path)
|
|
if err != nil {
|
|
return errors.Wrap(err, "failed to initialize DB")
|
|
}
|
|
default:
|
|
return fmt.Errorf("RelationalDB type: %s is not supported in query service", engine)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetDB is used by ee for setting modelDAO
|
|
func SetDB(m ModelDao) {
|
|
db = m
|
|
}
|
|
|
|
func DB() ModelDao {
|
|
if db == nil {
|
|
// Should never reach here
|
|
panic("GetDB called before initialization")
|
|
}
|
|
return db
|
|
}
|