package storage import ( "fmt" "github.com/spf13/viper" ) type Storage interface { CreateFirebaseToken(userId string, fcmToken string, devicePlatform string) (err error) UpdateFirebaseToken(userId string, fcmToken string, devicePlatform string) error GetFirebaseToken(userId string) (fcm string, devicePlatform string, err error) } func NewStorage(cfg *viper.Viper) (Storage, error) { var ( storageType = cfg.GetString("storage.db.type") ) switch storageType { case "psql": s, err := NewPostgresqlStorage(cfg) return s, err default: return nil, fmt.Errorf("storage type %v is not supported", storageType) } }