Golang Gin web framework template project

## Steps to run Go Template project on local

- Server is a golang gin framework developed at Go v1.20.08+
- Before running update following files according to environment:
  - Update db related config in - `database.json`
  - Server requires mongodb database (version 4.4.13)
- To run:
  - `go mod tidy`
  - `go run main.go`
- To Build:
  - To log errors from commandline, prepare build in `Production` mode. 
  - Set `IS_PRODUCTION = true` in **main.go** file for production build. And create build with below command. 
     ```go
     go build -tags prod
     ```

## Test the gotemplate project

- `GoTemplate.postman_collection.json` postman collection.

## Pprof usage

- To check pprof uncomment pprof call from main file.
- Use profiling for your server see the documentation  <https://pkg.go.dev/net/http/pprof>
- also after starting pprof server use this command to check profiling
    `go tool pprof http://localhost:YOUR_PPROF_PORT/debug/pprof/heap`

## JWT Usage

- To use jwt authentication and its variables uncomment decodeToken method to access all token variables.

## MySQL Connection

- To get Mysql DB connection using provided json file just uncomment the  `InitMysqlDBConnectionUsingJson` method from main file.

## MSSQLServer Connection

- To get sql server connection using provided json file just uncomment the  `InitSQLServerConnectionUsingJson` method from main file.
- There are two ways we can get connection object.
  1. first is using GetSQLServerDAO() method:
     `GetSQLServerDAO()` returns the default sql server connection object.
  2. second is using GetSQLServerDAOWithHost("hostName") method:
     `GetSQLServerDAOWithHost("hostName")` returns the sql server connection object of specified HostName.
     This method is used when we need to get connection object, other than default database.

 ## Immudb Operations
 - To get immudb server connection using provided json file just uncomment the       `InitImmuDBConnectionUsingJson` method from main file.
 -  To get the connection object GetImmuDAOWithHost(coreimmudb.DefaultHostName) method is used.
   `GetImmuDAOWithHost(coreimmudb.DefaultHostName)` returns the immudb server connection object of    specified HostName. This method is used when we need to get connection object, other than default database.

 Note: All Immudb operations' result is in Base64 format.    


## database json format

```json

{
  "MongoConfig": [
    {
      "hostName": "CoreStudio",
      "server": "localhost",
      "port": 27017,
      "username": "",
      "password": "",
      "database": "CoreStudio",
      "isDefault": true
    }
  ],
  "ImmudbConfig":[{
    "hostName":   "ImmuDbHost",
     "server":    "localhost",
     "port":       3322,
     "database":   "",
     "username":   "",
     "password":   "",
     "isDefault":  true
  }],
  "MysqlConfig": [
    {
      "hostName": "MySQLHost",
      "server": "localhost",
      "port": 3306,
      "username": "",
      "password": "",
      "database": "",
      "isDefault":true
    }
  ],
  "SqlServerConfig": [
    {
      "connMaxLifetime": 0,
      "database": "",
      "dbType": "SQLSERVER",
      "hostName": "SQLServerHost",
      "isDefault": true,
      "maxIdleConns": 0,
      "maxOpenConns": 2,
      "parameters": [],
      "password": "",
      "port": 65142,
      "protocol": "",
      "server": "",
      "sqlParameters": [
        {
          "key": "testKey",
          "value": "testValue"
        },
        {
          "key": "boolFlag",
          "value": "false"
        },
        {
          "key": "intFlag",
          "value": "100"
        }
      ],
      "username": ""
    }
  ]
}
```