-
Notifications
You must be signed in to change notification settings - Fork 9
/
invite.go
29 lines (26 loc) · 880 Bytes
/
invite.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package storage
import (
"fmt"
"github.com/madappgang/identifo/v2/model"
"github.com/madappgang/identifo/v2/storage/boltdb"
"github.com/madappgang/identifo/v2/storage/dynamodb"
"github.com/madappgang/identifo/v2/storage/mem"
"github.com/madappgang/identifo/v2/storage/mongo"
)
// NewInviteStorage creates new invite storage from settings
func NewInviteStorage(settings model.DatabaseSettings) (model.InviteStorage, error) {
switch settings.Type {
case model.DBTypeBoltDB:
return boltdb.NewInviteStorage(settings.BoltDB)
case model.DBTypeMongoDB:
return mongo.NewInviteStorage(settings.Mongo)
case model.DBTypeDynamoDB:
return dynamodb.NewInviteStorage(settings.Dynamo)
case model.DBTypeFake:
fallthrough
case model.DBTypeMem:
return mem.NewInviteStorage()
default:
return nil, fmt.Errorf("invite storage type is not supported %s ", settings.Type)
}
}