Extend PostgreSQL implementation and unit tests on MongoDB storage

This commit is contained in:
2023-05-02 00:34:33 +02:00
parent 1bf02aa132
commit c6ba00b74f
18 changed files with 870 additions and 752 deletions

View File

@@ -30,11 +30,15 @@ func NewStorage(cfg *viper.Viper) (Storage, error) {
type DBStorage interface {
GetAccount(id string) (*Account, error)
LocalAuthentication(namespace string, username string, email string, phone_number string) (*Account, error)
LocalAuthentication(namespace string, username *string, email *string, phone_number *string) (*Account, error)
GetAccounts(namespaces []string) ([]Account, error)
GetAccountsByIds(accountids []string) ([]Account, error)
CreateAccount(account Account) error
//TODO : remove UpdateAccount, implement UpdateAccountData and UpdateAccountLocalAuthentication
UpdateAccount(account Account) error
Migrate() error
}
func NewDBStorage(cfg *viper.Viper) (DBStorage, error) {
@@ -66,3 +70,7 @@ func NewKVStore(cfg *viper.Viper) (KVStore, error) {
kv, err := NewEtcdKVStore(cfg)
return kv, err
}
func Ptr[T any](v T) *T {
return &v
}