Some checks failed
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
package db
|
|
|
|
import (
|
|
"github.com/tech/sendico/pkg/auth"
|
|
"github.com/tech/sendico/pkg/db/account"
|
|
"github.com/tech/sendico/pkg/db/confirmation"
|
|
mongoimpl "github.com/tech/sendico/pkg/db/internal/mongo"
|
|
"github.com/tech/sendico/pkg/db/invitation"
|
|
"github.com/tech/sendico/pkg/db/organization"
|
|
"github.com/tech/sendico/pkg/db/policy"
|
|
"github.com/tech/sendico/pkg/db/refreshtokens"
|
|
"github.com/tech/sendico/pkg/db/role"
|
|
"github.com/tech/sendico/pkg/db/transaction"
|
|
"github.com/tech/sendico/pkg/merrors"
|
|
"github.com/tech/sendico/pkg/mlogger"
|
|
)
|
|
|
|
// Factory exposes high-level repositories used by application services.
|
|
type Factory interface {
|
|
NewRefreshTokensDB() (refreshtokens.DB, error)
|
|
NewConfirmationsDB() (confirmation.DB, error)
|
|
|
|
NewAccountDB() (account.DB, error)
|
|
NewOrganizationDB() (organization.DB, error)
|
|
NewInvitationsDB() (invitation.DB, error)
|
|
|
|
NewRolesDB() (role.DB, error)
|
|
NewPoliciesDB() (policy.DB, error)
|
|
|
|
TransactionFactory() transaction.Factory
|
|
|
|
Permissions() auth.Provider
|
|
|
|
CloseConnection()
|
|
}
|
|
|
|
// NewConnection builds a Factory backed by the configured driver.
|
|
func NewConnection(logger mlogger.Logger, config *Config) (Factory, error) {
|
|
if config.Driver == Mongo {
|
|
return mongoimpl.NewConnection(logger, config.Settings)
|
|
}
|
|
return nil, merrors.InvalidArgument("unknown database driver: "+string(config.Driver), "config.driver")
|
|
}
|