dbhandler

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConnection

func GetConnection() (*gorm.DB, *mongo.Client, error)

GetConnection retrieves the database connection based on the LOG_GUARDIAN_DATABASE_TYPE environment variable.

It returns the *gorm.DB and *mongo.Client connections and an error.

func InsertBaseLog

func InsertBaseLog(db *gorm.DB, log pkg.LogDetails) error

InsertBaseLog inserts a LogDetails into the database.

It takes a *gorm.DB and a pkg.LogDetails as parameters. It returns an error.

func InsertDatabaseLog

func InsertDatabaseLog(db *gorm.DB, log pkg.LogDatabase) error

InsertDatabaseLog inserts a database log into the given *gorm.DB instance.

It takes the following parameter(s): - db: a pointer to a gorm.DB instance representing the database connection. - log: a pkg.LogDatabase struct representing the log to be inserted.

It returns an error if there was an issue inserting the log.

func InsertFunctionLog

func InsertFunctionLog(db *gorm.DB, log pkg.LogFunction) error

InsertFunctionLog inserts a function log into the database.

Parameters: - db: The gorm.DB object representing the database connection. - log: The pkg.LogFunction object representing the function log to be inserted.

Returns: - error: An error, if any occurred during the database insert operation.

func InsertRequestLog

func InsertRequestLog(db *gorm.DB, log pkg.LogRequest) error

InsertRequestLog inserts a request log into the database.

It takes a *gorm.DB object as the first parameter, which represents the database connection, and a pkg.LogRequest object as the second parameter, which contains the request log data.

It returns an error if there was an issue inserting the request log into the database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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