LogoLogo
WebsiteTechnical Discussions
Developer documentation
Developer documentation
  • Public Technical Documentation
    • device-management-service
      • main
        • actor
        • api
        • cmd
          • actor
          • cap
        • db
          • clover
          • repositories
        • dms
          • behaviors
          • jobs
          • node
          • onboarding
          • resources
        • docs
          • deployments
          • onboarding
          • private_network
        • executor
          • docker
          • firecracker
          • background_tasks
          • config
          • hardware
        • maint-scripts
        • network
          • libp2p
        • observability
        • specs
          • basic_controller
          • s3
          • volume
          • e2e
        • tokenomics
        • types
        • utils
          • validate
      • release
        • actor
        • api
        • cmd
          • actor
          • cap
        • db
          • repositories
            • clover
        • dms
          • behaviors
          • hardware
          • jobs
          • node
          • onboarding
          • resources
        • docs
          • deployments
          • onboarding
          • private_network
        • executor
          • docker
          • firecracker
        • internal
          • background_tasks
          • config
        • maint-scripts
        • network
          • libp2p
        • observability
        • plugins
        • specs
        • storage
          • basic_controller
          • s3
          • volume
        • test
        • tokenomics
        • types
        • utils
          • validate
    • solutions
      • asi-node
        • main
          • demos
            • ocap_auth
              • ansible
              • videos
          • did-auth-use-scenarios
            • create-a-hosting-deployment
            • make-a-payment
            • manage-dids-and-ocaps
            • register-an-ai-agent
            • submit-a-compute-job
          • pilots
            • asi-create-authentication-poc
        • release
      • nunet-appliance
        • main
        • release
    • test-suite
      • main
        • cicd
          • tests
            • acceptance_tests
            • feature_environment
          • cli
          • dms-on-lxd
            • local
        • environments
          • development
          • feature
          • production
          • staging
        • infrastructure
          • acc-tests-config-maker
          • cloud-init
          • nginx
        • stages
          • dependency_scanning
          • functional_tests
          • integration_tests
          • load_tests
          • regression_tests
          • security_tests_1
          • security_tests_2
          • security_tests_live
          • unit_tests
          • user_acceptance_tests
      • release
        • cicd
          • tests
            • acceptance_tests
            • feature_environment
          • cli
          • dms-on-lxd
            • local
        • environments
          • development
          • feature
          • production
          • staging
        • infrastructure
          • acc-tests-config-maker
          • cloud-init
          • nginx
        • stages
          • dependency_scanning
          • functional_tests
          • integration_tests
          • load_tests
          • regression_tests
          • security_tests_1
          • security_tests_2
          • security_tests_live
          • unit_tests
          • user_acceptance_tests
    • team-processes-and-guidelines
      • main
        • best_practices
        • ci_cd_pipeline
        • community_feedback_process
        • contributing_guidelines
        • git_workflows
        • nunet_test_process_and_environments
        • secure_coding_guidelines
        • specification_and_documentation
        • team_process
          • a_project_management
          • b_ceremonies_artifacts
          • c_drum_buffer_rope
          • d_development_process
          • e_culture_rules
          • f_mr_review
        • vulnerability_management
          • devsecops_maturity_models
          • nunet_security_pipeline
          • secret_management
          • sop_security_mr_review
Powered by GitBook
On this page
  • db
  • Table of Contents
  • Specification
Export as PDF
  1. Public Technical Documentation
  2. device-management-service
  3. main

db

PreviouscapNextclover

Last updated 2 hours ago

Last updated: 2025-06-06 01:05:25.984715 File source:

db

Table of Contents

Specification

Description

This package defines the local database functionality for the Device Management Service (DMS). It provides a generic repository pattern for database operations with a clover implementation, which is a NoSQL or document oriented database implementation.

The package uses generic interfaces to support different data types and provides query condition functions for building database queries.

Structure and Organisation

Here is quick overview of the contents of this pacakge:

    • Various test files for ensuring functionality works as expected.

Class Diagram

The class diagram for the db package is shown below.

Source file

Rendered from source file

!$rootUrlGitlab = "https://gitlab.com/nunet/device-management-service/-/raw/main"
!$packageRelativePath = "/db"
!$packageUrlGitlab = $rootUrlGitlab + $packageRelativePath
 
!include $packageUrlGitlab/specs/class_diagram.puml

Package Specification

Key Interfaces

  1. GenericRepository: Defines basic CRUD operations (Create, Read, Update, Delete) and standard querying methods using generic types, allowing it to be used with any data type.

  2. GenericEntityRepository: Defines operations for repositories handling a single record, with methods for saving, retrieving, clearing, and tracking history.

Query Conditions

The package provides functions to create query conditions for database operations:

  • EQ: Creates equality comparison (field = value)

  • GT: Creates greater-than comparison (field > value)

  • GTE: Creates greater-than-or-equal comparison (field >= value)

  • LT: Creates less-than comparison (field < value)

  • LTE: Creates less-than-or-equal comparison (field <= value)

  • IN: Creates IN comparison (field IN values)

  • LIKE: Creates LIKE comparison for pattern matching (field LIKE pattern)

: Current file which is aimed towards developers who wish to use and modify the package functionality.

: This folder contains the core interfaces and implementations for database operations.

: Defines the GenericRepository interface with basic CRUD operations and standard querying methods using generic types.

: Defines the GenericEntityRepository interface for repositories handling a single record.

: Contains query condition functions (EQ, GT, GTE, LT, LTE, IN, LIKE) for building database queries.

: Contains unit tests for the query condition functions.

: Contains utility functions for database operations.

: Contains unit tests for the utility functions.

: Defines error types for database operations.

: Contains the CloverDB (NoSQL) implementation of the repository interfaces.

: Implements the GenericRepository interface for CloverDB.

: Implements the GenericEntityRepository interface for CloverDB.

: Contains the CloverDB connection and initialization logic.

: This folder contains the class diagram of the package.

Refer to the file defined in the repositories folder for detailed specification of the package.

README
repositories
generic_repository.go
generic_entity_repository.go
conditions.go
conditions_test.go
utils.go
utils_test.go
errors.go
clover
generic_repository.go
generic_entity_repository.go
clover.go
specs
db Class diagram
README
link on GitLab
Project README
Release/Build Status
Changelog
License
Contribution Guidelines
Code of Conduct
Secure Coding Guidelines
Description
Structure and Organisation
Class Diagram
Package Specification