continued auth system
This commit is contained in:
@@ -1,10 +1,29 @@
|
||||
package db_cold
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
"zomo.dev/largehadroncollider/util"
|
||||
)
|
||||
|
||||
// sqlite file
|
||||
|
||||
func InitDBColdConn() (DBColdConn, error) {
|
||||
return DBColdConn{}, nil
|
||||
func InitDBColdConn(conf *util.Config) (*DBColdConn, error) {
|
||||
db, err := gorm.Open(sqlite.Open(conf.SQliteDB), &gorm.Config{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctx := context.Background()
|
||||
|
||||
cold := &DBColdConn{ db, ctx }
|
||||
cold.initUserAuth()
|
||||
|
||||
return cold, nil
|
||||
}
|
||||
|
||||
type DBColdConn struct {
|
||||
Gorm *gorm.DB
|
||||
Ctx context.Context
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user