Template for README files for DMS documentation
The below content proposes a structure for README
prepared by @0xPravar that can be followed to document the functionality offered by DMS.
Introduction
<High level explanation of the package and its core functionalities. It is recommended to mention what the package is used for and how it is intended to be used>
Structure and organisation
<Overview of sub-packages (if applicable) and all files present in the package folder>
Contributing
<Sample content that should see minimal changes>
For guidelines of how to contribute, install and test the device-management-service
component which contains <package_name>
package, please refer to component level documentation:
- DMS component level ../../README.md
- Contribution guidelines ../../CONTRIBUTING.md
- Code of conduct ../../CODE_OF_CONDUCT.md
- Secure coding guidelines
<Package>
Functionality
<explain the package interface and the methods. See below for sample method with sequence diagram included>
Create
- signature:
Create(ctx context.Context, data T) -> (T, error)
- input #1: Go context
- input #2 (closed): Data to be added to the database. It should be of type used to initialise the repository
- output (success): Data type used to initialise the repository
- output (error): error message
Create
function adds a new record to the database and returns the created data. It returns an error message in case of any error during the operation.
For list of steps during execution, refer to the sequence diagram files:
sequenceDiagram
participant dms as DMS
participant db as Database
autonumber
rect rgb(252, 242, 232)
loop Create a new record
dms ->> db: Call Create method <br> dms.database.gorm.Create
Note right of dms: This will most likely be a internal call by another DMS component
db ->> db: Create a new record with data provided using Gorm internal method
db ->> dms: Return (created data, error)
end %loop
end %rect
List of Data Types
<Explain the main data types used in the package. Use the naming convention to help the reader identify where this data type is located>
db.query
: This contains parameters related to a query that is passed to the database.
models.SpecConfig
: This allows arbitrary configuration/parameters as needed during implementation of specific executor.
---
Testing the Functionality
<Explain the scenarios and test cases that developers can use/refer to. This can include unit tests and Gherkin feature files>
cc: @kabir.kbr