Nityananda Gohain eba2049a4d
fix: signoz shouldn't panic with postgres provider (#7138)
All necessary changes so that whatever initalize SQL commans run, they are moved to bun so that it works with both sqlite and postgres.
2025-02-18 11:08:09 +05:30

32 lines
486 B
Go

package dao
import (
"go.signoz.io/signoz/pkg/query-service/dao/sqlite"
"go.signoz.io/signoz/pkg/sqlstore"
)
var db ModelDao
func InitDao(sqlStore sqlstore.SQLStore) error {
var err error
db, err = sqlite.InitDB(sqlStore)
if err != nil {
return err
}
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
}