clover
Last updated
Last updated
Last updated: 2024-11-07 21:05:00.194303 File source:
This sub package contains CloverDB implementation of the database interfaces.
Here is quick overview of the contents of this pacakge:
All files with *_test.go
naming convention contain unit tests with respect to the specific implementation.
The class diagram for the clover
package is shown below.
Source file
Rendered from source file
GenericRepository
NewGenericRepository
signature: NewGenericRepository[T repositories.ModelType](db *clover.DB) -> repositories.GenericRepository[T]
input: clover Database object
output: Repository of type db.clover.GenericRepositoryclover
NewGenericRepository
function creates a new instance of GenericRepositoryclover
struct. It initializes and returns a repository with the provided clover database.
Interface Methods
query
signature: query(includeDeleted bool) -> *clover_q.Query
input: boolean value to choose whether to include deleted records
queryWithID
signature: queryWithID(id interface{}, includeDeleted bool) -> *clover_q.Query
input #1: identifier
input #2: boolean value to choose whether to include deleted records
Providing includeDeleted
as False
will add a condition to exclude the deleted records.
GenericEntityRepository
NewGenericEntityRepository
signature: NewGenericEntityRepository[T repositories.ModelType](db *clover.DB) repositories.GenericEntityRepository[T]
input: clover Database object
output: Repository of type db.clover.GenericEntityRepositoryclover
NewGenericEntityRepository
creates a new instance of GenericEntityRepositoryclover
struct. It initializes and returns a repository with the provided clover database instance and name of the collection in the database.
Interface Methods
query
signature: query() -> *clover_q.Query
input: None
db.clover.GenericRepositoryClover
: This is a generic repository implementation using clover as an ORM
db.clover.GenericEntityRepositoryClover
: This is a generic single entity repository implementation using clover 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.
: Current file which is aimed towards developers who wish to use and modify the database functionality.
: This file implements the methods of GenericRepository
interface.
: This file implements the methods of GenericEntityRepository
interface.
: This file contains implementation of DeploymentRequestFlat
interface.
: This file contains implementation of RequestTracker
interface.
: This file contains implementation of VirtualMachine
interface.
: This file contains implementation of interfaces defined in .
: This file contains utility functions with respect to clover implementation.
See db
package for methods of GenericRepository
interface
output:
query
function creates and returns a new CloverDB object. Input value of False
will add a condition to exclude the deleted records.
output:
queryWithID
function creates and returns a new CloverDB object. The provided inputs are added to query conditions. The identifier will be compared to primary key field value of the repository.
See db
package for methods of GenericEntityRepository
interface.
output:
query
function creates and returns a new CloverDB object.