Last updated: 2024-11-21 22:06:01.931280 File source: link on GitLab
This sub package contains Gorm implementation of the database interfaces.
Here is quick overview of the contents of this pacakge:
README: Current file which is aimed towards developers who wish to use and modify the database functionality.
generic_repository: This file implements the methods of GenericRepository
interface.
generic_entity_repository: This file implements the methods of GenericEntityRepository
interface.
deployment: This file contains implementation of DeploymentRequestFlat
interface.
elk_stats: This file contains implementation of RequestTracker
interface.
firecracker: This file contains implementation of VirtualMachine
interface.
machine: This file contains implementation of interfaces defined in machine.go.
utils: This file contains utility functions with respect to Gorm implementation.
All files with *_test.go
naming convention contain unit tests with respect to the specific implementation.
The class diagram for the gorm
package is shown below.
Source file
Rendered from source file
GenericRepository
NewGenericRepository
signature: NewGenericRepository[T repositories.ModelType](db *gorm.DB) -> repositories.GenericRepository[T]
input: Gorm Database object
output: Repository of type db.gorm.GenericRepositoryGORM
NewGenericRepository
function creates a new instance of GenericRepositoryGORM
struct. It initializes and returns a repository with the provided GORM database.
Interface Methods
See db
package readme for methods of GenericRepository
interface.
GenericEntityRepository
NewGenericEntityRepository
signature: NewGenericEntityRepository[T repositories.ModelType](db *gorm.DB) -> repositories.GenericEntityRepository[T]
input #1: Gorm Database object
output: Repository of type db.gorm.GenericEntityRepositoryGORM
NewGenericEntityRepository
creates a new instance of GenericEntityRepositoryGORM
struct. It initializes and returns a repository with the provided GORM database.
Interface Methods
See db
package readme for methods of GenericEntityRepository
interface.
db.gorm.GenericRepositoryGORM
: This is a generic repository implementation using GORM as an ORM.
db.gorm.GenericEntityRepositoryGORM
: This is a generic single entity repository implementation using GORM as an ORM
For other data types refer to db
package readme.
Refer to *_test.go
files for unit tests of different functionalities.
List of issues
All issues that are related to the implementation of db
package can be found below. These include any proposals for modifications to the package or new functionality needed to cover the requirements of other packages.