infrastructure

package
v3.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectMongoDB

func ConnectMongoDB(ctx context.Context, dsn string) (*mongo.Database, error)

ConnectMongoDB opens a connection to the MongoDB and ensures that the db is reachable

func ConnectMysqlDB added in v3.8.7

func ConnectMysqlDB(ctx context.Context, dsn string) (*sql.DB, error)

ConnectMysqlDB opens a connection to the MysqlDB and ensures that the db is reachable

func ConnectOracleDB added in v3.8.8

func ConnectOracleDB(ctx context.Context, dsn string) (*sql.DB, error)

ConnectOracleDB opens a connection to the OracleDB and ensures that the db is reachable

func ConnectPostgresDB

func ConnectPostgresDB(ctx context.Context, dsn string) (*sql.DB, error)

ConnectPostgresDB opens a connection to the PostgresDB and ensures that the db is reachable

func MigrateMysqlDB added in v3.8.7

func MigrateMysqlDB(db *sql.DB, migrationsDir string) error

MigrateMysqlDB runs all migrations found in the given directory against the db

func MigrateOracleDB added in v3.8.8

func MigrateOracleDB(db *sql.DB, migrationsDir string) error

MigrateOracleDB runs all migrations found in the given directory against the db

func MigratePostgresDB

func MigratePostgresDB(db *sql.DB, migrationsDir string) error

MigratePostgresDB runs all migrations found in the given directory against the db

Types

type MongoRepository

type MongoRepository struct {
	DB         *mongo.Database
	Collection *mongo.Collection
	Target     interface{}
}

MongoRepository struct of a mongo repository Implements the Repository interface

func (*MongoRepository) Create

func (r *MongoRepository) Create(ctx context.Context, entity interface{}) (string, error)

Create creates an entity in the repository's collection

func (*MongoRepository) Delete

func (r *MongoRepository) Delete(ctx context.Context, ID string) error

Delete deletes the document with the specified ID in the repository's collection

func (*MongoRepository) Get

func (r *MongoRepository) Get(ctx context.Context, filter map[string]interface{}, skip, take *int) ([]interface{}, error)

Get gets the documents mathing the filter in the repository's collection

func (*MongoRepository) GetByID

func (r *MongoRepository) GetByID(ctx context.Context, ID string) (interface{}, error)

GetByID get the document with the specified ID in the repository's collection

func (*MongoRepository) Update

func (r *MongoRepository) Update(ctx context.Context, ID string, entity interface{}) error

Update updates the document with the specified ID in the repository's collection

type MysqlRepository added in v3.8.7

type MysqlRepository struct {
	DB *sql.DB
}

MysqlRepository struct of a mysql repository Needs a specific implementation of the Repository interface for every entity

type OracleRepository added in v3.8.8

type OracleRepository struct {
	DB *sql.DB
}

OracleRepository struct of a oracle repository Needs a specific implementation of the Repository interface for every entity

type PostgresRepository

type PostgresRepository struct {
	DB *sql.DB
}

PostgresRepository struct of a mongo repository Needs a specific implementation of the Repository interface for every entity

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL