Lots of work

This commit is contained in:
mStar 2024-05-31 11:54:39 +02:00
parent a2a937791d
commit 3086b0e9b4
28 changed files with 1284 additions and 2 deletions

36
storage/storage.go Normal file
View file

@ -0,0 +1,36 @@
package storage
import (
"github.com/glebarez/sqlite"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
type Storage struct {
db *gorm.DB
}
func NewStorageSqlite(filePath string) (*Storage, error) {
db, err := gorm.Open(sqlite.Open(filePath))
if err != nil {
return nil, err
}
return &Storage{
db: db,
}, nil
}
func NewStoragePostgres(dbUrl string) (*Storage, error) {
db, err := gorm.Open(postgres.Open(dbUrl))
if err != nil {
return nil, err
}
return &Storage{
db: db,
}, nil
}
// TODO: Placeholder. Update to proper implementation later. Including signature
func (s *Storage) FindLocalAccount(handle string) (string, error) {
return handle, nil
}