{"id":15187299,"url":"https://github.com/lordofthemind/mygopher","last_synced_at":"2026-03-02T02:40:18.113Z","repository":{"id":256358761,"uuid":"855034595","full_name":"lordofthemind/mygopher","owner":"lordofthemind","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-11T17:25:56.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-03T07:35:38.804Z","etag":null,"topics":["gin","go","golang","gorm","jwt","mongodb","mygopher","paseto","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lordofthemind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-10T07:32:08.000Z","updated_at":"2024-12-11T17:26:00.000Z","dependencies_parsed_at":"2024-10-11T09:40:57.888Z","dependency_job_id":null,"html_url":"https://github.com/lordofthemind/mygopher","commit_stats":null,"previous_names":["lordofthemind/mygopher"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lordofthemind/mygopher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordofthemind%2Fmygopher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordofthemind%2Fmygopher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordofthemind%2Fmygopher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordofthemind%2Fmygopher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lordofthemind","download_url":"https://codeload.github.com/lordofthemind/mygopher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordofthemind%2Fmygopher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285359022,"owners_count":27158216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gin","go","golang","gorm","jwt","mongodb","mygopher","paseto","postgresql"],"created_at":"2024-09-27T18:09:43.628Z","updated_at":"2025-11-20T02:03:01.954Z","avatar_url":"https://github.com/lordofthemind.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MyGopher\n\n**MyGopher** is a collection of utility packages written in Go, designed to simplify common tasks such as web server setup, middleware integration, database connections (MongoDB, PostgreSQL), and token management (JWT and Paseto). Each package is modular, allowing you to integrate them into your project as needed.\n\n## Table of Contents\n\n- [GopherGin](#gophergin)\n- [GopherMiddleware](#gophermiddleware)\n- [GopherMongo](#gophermongo)\n- [GopherPostgres](#gopherpostgres)\n- [GopherToken](#gophertoken)\n\n---\n\n## GopherGin\n\n**Package:** `gophergin`\n\n### About\n\nThe `gophergin` package provides a set of tools for setting up a Gin web server with customizable configurations. It supports both CORS-enabled and non-CORS setups, static file serving, template loading, TLS (HTTPS) support, and graceful shutdowns. This package helps developers create production-ready HTTP servers with ease.\n\n## Installation\n\nTo install and use the `gophergin` package, follow these steps:\n\n1. First, make sure you have [Go](https://golang.org/dl/) installed and properly set up.\n2. Run the following command to install the `gophergin` package and its dependencies:\n\n```bash\ngo get github.com/lordofthemind/mygopher/gophergin\n```\n\nThis command fetches the package from the repository and installs it in your Go workspace.\n\n3. After installing, you can import and use the package in your Go project like this:\n\n```go\nimport \"github.com/lordofthemind/mygopher/gophergin\"\n```\n\n### Types\n\n#### `ServerConfig`\n`ServerConfig` holds the configuration for setting up the Gin server.\n\n**Fields:**\n- `Port`: The port on which the server will listen (e.g., `8080`).\n- `StaticPath`: Path to static files to be served (e.g., `./static`).\n- `TemplatePath`: Path to HTML templates (e.g., `./templates`).\n- `UseTLS`: A boolean flag to indicate whether TLS/HTTPS should be used.\n- `TLSCertFile`: Path to the TLS certificate file.\n- `TLSKeyFile`: Path to the TLS private key file.\n- `UseCORS`: A boolean flag to enable CORS.\n- `CORSConfig`: Configuration for the CORS middleware if `UseCORS` is true.\n\n#### `ServerSetup`\n`ServerSetup` is an interface for setting up a Gin server.\n\n### Functions\n\n#### `SetUpServer(config ServerConfig) (*gin.Engine, error)`\n\n**CorsServerSetup**\n\nThis method sets up a Gin server with optional CORS support, static file serving, and template loading.\n\n**Parameters:**\n- `config`: An instance of `ServerConfig` with the server's configuration.\n\n**Returns:**\n- `*gin.Engine`: The Gin engine (router) instance, which can be used to define routes and start the server.\n- `error`: An error if the server setup fails.\n\n**Example usage:**\n\n```go\nserverConfig := ServerConfig{\n    StaticPath:   \"./static\",\n    TemplatePath: \"./templates\",\n    UseCORS:      true,\n    CORSConfig: cors.Config{\n        AllowOrigins: []string{\"https://example.com\"},\n        AllowMethods: []string{\"GET\", \"POST\"},\n    },\n}\n\nrouter, err := (\u0026CorsServerSetup{}).SetUpServer(serverConfig)\nif err != nil {\n    log.Fatalf(\"Failed to set up server: %v\", err)\n}\n```\n\n#### `StartGinServer(router *gin.Engine, config ServerConfig) error`\n\nStarts the Gin server using the provided router configuration. It supports both HTTP and HTTPS (TLS) setups.\n\n**Parameters:**\n- `router`: The `*gin.Engine` instance to start.\n- `config`: The `ServerConfig` containing server options like port and TLS files.\n\n**Returns:**\n- `error`: An error if the server fails to start.\n\n**Example usage:**\n\n```go\nerr := StartGinServer(router, serverConfig)\nif err != nil {\n    log.Fatalf(\"Failed to start server: %v\", err)\n}\n```\n\n#### `GracefulShutdown(server *http.Server)`\n\nHandles the graceful shutdown of the server when an interrupt signal (Ctrl+C) is received. It ensures all in-flight requests are completed before shutting down within a given timeout (5 seconds).\n\n**Parameters:**\n- `server`: The `*http.Server` instance representing the running Gin server.\n\n**Example usage:**\n\n```go\ngo GracefulShutdown(\u0026http.Server{Addr: \":8080\"})\n```\n\n#### `LoadTLSCertificate(certFile, keyFile string) (tls.Certificate, error)`\n\nLoads the TLS certificate and private key from the specified files to enable HTTPS for the server.\n\n**Parameters:**\n- `certFile`: Path to the TLS certificate file.\n- `keyFile`: Path to the TLS key file.\n\n**Returns:**\n- `tls.Certificate`: The loaded TLS certificate.\n- `error`: An error if the certificate fails to load.\n\n**Example usage:**\n\n```go\ncert, err := LoadTLSCertificate(\"/path/to/cert.crt\", \"/path/to/key.key\")\nif err != nil {\n    log.Fatalf(\"Failed to load TLS certificate: %v\", err)\n}\n```\n\n### Example Usage\n\n```go\npackage main\n\nimport (\n    \"log\"\n    \"github.com/gin-contrib/cors\"\n    \"github.com/lordofthemind/mygopher/gophergin\"\n)\n\nfunc main() {\n    // Define server configuration\n    serverConfig := gophergin.ServerConfig{\n        Port:         8080,\n        StaticPath:   \"./static\",\n        TemplatePath: \"./templates\",\n        UseTLS:       false,\n        UseCORS:      true,\n        CORSConfig: cors.Config{\n            AllowOrigins: []string{\"https://example.com\"},\n            AllowMethods: []string{\"GET\", \"POST\"},\n        },\n    }\n\n    // Set up the server with CORS support\n    router, err := (\u0026gophergin.CorsServerSetup{}).SetUpServer(serverConfig)\n    if err != nil {\n        log.Fatalf(\"Failed to set up server: %v\", err)\n    }\n\n    // Start the server\n    if err := gophergin.StartGinServer(router, serverConfig); err != nil {\n        log.Fatalf(\"Failed to start server: %v\", err)\n    }\n\n    // Gracefully shutdown on interrupt\n    gophergin.GracefulShutdown(\u0026http.Server{Addr: \":8080\"})\n}\n```\n\n### Notes\n- **TLS Support**: To enable HTTPS, set `UseTLS` to `true` and provide valid paths for `TLSCertFile` and `TLSKeyFile`.\n- **Graceful Shutdown**: The `GracefulShutdown` function ensures that the server is terminated gracefully without abruptly closing active connections.\n- **CORS Configuration**: The CORS settings can be customized via `CORSConfig` in `ServerConfig`.\n\n\n---\n\n## GopherMiddleware\n\n**Package:** `gophermiddleware`\n\n### About\n\nThe `gophermiddleware` package provides middleware components that can be plugged into your web server (Gin, Echo, etc.). It’s designed to handle various HTTP request and response modifications or checks.\n\n### Example Usage\n\nTo be filled in once additional middleware features are added.\n\n---\n\n## GopherMongo\n\n**Package:** `gophermongo`\n\n### About\n\nThe `gophermongo` package provides utilities to establish a connection to a MongoDB server, retrieve databases, and access collections. It supports connection retries, context-based timeouts, and simplified database and collection retrieval.\n\nThis package is designed to handle common MongoDB operations with minimal configuration, allowing for easy integration with Go projects.\n\n### Installation\n\nTo install and use the `gophermongo` package, run the following command:\n\n```bash\ngo get github.com/lordofthemind/mygopher/gophermongo\n```\n\nAfter installation, import the package in your Go project:\n\n```go\nimport \"github.com/lordofthemind/mygopher/gophermongo\"\n```\n\n### Functions\n\n#### `ConnectToMongoDB(ctx, dsn, timeout, maxRetries)`\n\nEstablishes a connection to MongoDB with a specified context timeout and retry mechanism. The function attempts to connect up to `maxRetries` times, waiting 5 seconds between each retry.\n\n**Parameters:**\n- `ctx`: Context for managing the connection timeout.\n- `dsn`: The MongoDB connection string (Data Source Name).\n- `timeout`: Duration for the connection timeout (e.g., `10*time.Second`).\n- `maxRetries`: Maximum number of retries before returning an error.\n\n**Returns:**\n- `*mongo.Client`: The connected MongoDB client instance on success.\n- `error`: An error if the connection fails.\n\n**Details:**\n- The function will retry the connection in case of failure up to the specified number of retries (`maxRetries`).\n- If a connection cannot be established within the provided `timeout`, it will return an error indicating the context has timed out.\n\n**Example Usage:**\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/lordofthemind/mygopher/gophermongo\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclient, err := gophermongo.ConnectToMongoDB(ctx, \"mongodb://localhost:27017\", 10*time.Second, 3)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to connect to MongoDB: %v\", err)\n\t}\n\tdefer client.Disconnect(ctx)\n\n\t// Now you can use the client to interact with the database\n}\n```\n\n---\n\n#### `GetDatabase(client, dbName)`\n\nRetrieves a specified MongoDB database instance from the connected client.\n\n**Parameters:**\n- `client`: The MongoDB client instance.\n- `dbName`: The name of the database to retrieve.\n\n**Returns:**\n- `*mongo.Database`: The MongoDB database instance.\n\n**Details:**\n- Use this function to retrieve a database once you have successfully connected to MongoDB.\n\n**Example Usage:**\n\n```go\ndatabase := gophermongo.GetDatabase(client, \"myDatabase\")\n```\n\n---\n\n#### `GetCollection(db, collectionName)`\n\nRetrieves a specified MongoDB collection from the given database.\n\n**Parameters:**\n- `db`: The MongoDB database instance.\n- `collectionName`: The name of the collection to retrieve.\n\n**Returns:**\n- `*mongo.Collection`: The MongoDB collection instance.\n\n**Details:**\n- Once you have a collection, you can perform CRUD operations on it (insert, find, update, delete).\n\n**Example Usage:**\n\n```go\ncollection := gophermongo.GetCollection(database, \"myCollection\")\n```\n\n---\n\n### Example Usage (Full)\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/lordofthemind/mygopher/gophermongo\"\n)\n\nfunc main() {\n\t// Set up context and connection parameters\n\tctx := context.Background()\n\tclient, err := gophermongo.ConnectToMongoDB(ctx, \"mongodb://localhost:27017\", 10*time.Second, 3)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to connect to MongoDB: %v\", err)\n\t}\n\tdefer client.Disconnect(ctx)\n\n\t// Get the database\n\tdatabase := gophermongo.GetDatabase(client, \"myDatabase\")\n\n\t// Get the collection\n\tcollection := gophermongo.GetCollection(database, \"myCollection\")\n\n\t// Now you can use the collection for CRUD operations\n\t// Example: collection.InsertOne(ctx, document)\n}\n```\n---\n\n## GopherPostgres\n\n**Package:** `gopherpostgres`\n\n### About\n\nThe `gopherpostgres` package facilitates connecting to PostgreSQL databases using either the standard SQL package or GORM (an ORM library). It includes retry logic and context-based timeouts, making it resilient and flexible for production use. This package provides functions to connect using raw SQL (`*sql.DB`) or GORM (`*gorm.DB`), making it easy to integrate with both standard and ORM-based database interactions.\n\n### Installation\n\nTo install and use the `gopherpostgres` package, run the following command:\n\n```bash\ngo get github.com/lordofthemind/mygopher/gopherpostgres\n```\n\nThen, import the package in your Go project:\n\n```go\nimport \"github.com/lordofthemind/mygopher/gopherpostgres\"\n```\n\n### Functions\n\n#### `ConnectPostgresDB(ctx, dsn, timeout, maxRetries)`\n\nConnects to a PostgreSQL database using the standard SQL driver. The function includes retry logic, which attempts to reconnect in case of failure up to the specified number of retries.\n\n**Parameters:**\n- `ctx`: Context for managing connection timeout and cancellation.\n- `dsn`: PostgreSQL connection string (Data Source Name).\n- `timeout`: Duration for the connection attempt (e.g., `10*time.Second`).\n- `maxRetries`: Maximum number of retries before returning an error.\n\n**Returns:**\n- `*sql.DB`: The connected PostgreSQL database instance on success.\n- `error`: An error if the connection fails after all retries.\n\n**Details:**\n- If the connection attempt fails, the function will retry up to `maxRetries` times, with a 5-second delay between each retry.\n- The function utilizes `sql.Open` and `db.PingContext` to ensure a valid connection is established.\n\n**Example Usage:**\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/lordofthemind/mygopher/gopherpostgres\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tdb, err := gopherpostgres.ConnectPostgresDB(ctx, \"postgres://user:password@localhost:5432/mydb\", 10*time.Second, 3)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to connect to PostgreSQL: %v\", err)\n\t}\n\tdefer db.Close()\n\n\t// Perform SQL operations\n\t// Example: db.QueryContext(ctx, \"SELECT * FROM users\")\n}\n```\n\n---\n\n#### `ConnectToPostgresGORM(ctx, dsn, timeout, maxRetries)`\n\nConnects to a PostgreSQL database using GORM. Similar to the raw SQL connection, this function includes retry logic and context-based timeouts to manage the connection lifecycle.\n\n**Parameters:**\n- `ctx`: Context for managing connection timeout and cancellation.\n- `dsn`: PostgreSQL connection string (Data Source Name).\n- `timeout`: Duration for the connection attempt (e.g., `10*time.Second`).\n- `maxRetries`: Maximum number of retries before returning an error.\n\n**Returns:**\n- `*gorm.DB`: The connected GORM PostgreSQL database instance on success.\n- `error`: An error if the connection fails after all retries.\n\n**Details:**\n- This function leverages GORM's `gorm.Open` to establish a connection using PostgreSQL. \n- If the connection fails, it retries up to `maxRetries` times with a 5-second delay between each retry.\n- Ideal for projects using an ORM for database operations.\n\n**Example Usage:**\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/lordofthemind/mygopher/gopherpostgres\"\n\t\"gorm.io/gorm\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tdb, err := gopherpostgres.ConnectToPostgresGORM(ctx, \"postgres://user:password@localhost:5432/mydb\", 10*time.Second, 3)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to connect to PostgreSQL using GORM: %v\", err)\n\t}\n\n\t// Use GORM for ORM-based database operations\n\t// Example: db.Find(\u0026users)\n}\n```\n\n---\n\n### Example Usage (Full)\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/lordofthemind/mygopher/gopherpostgres\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\t// Using standard SQL driver\n\tdbSQL, err := gopherpostgres.ConnectPostgresDB(ctx, \"postgres://user:password@localhost:5432/mydb\", 10*time.Second, 3)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to connect to PostgreSQL: %v\", err)\n\t}\n\tdefer dbSQL.Close()\n\n\t// Using GORM\n\tdbGORM, err := gopherpostgres.ConnectToPostgresGORM(ctx, \"postgres://user:password@localhost:5432/mydb\", 10*time.Second, 3)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to connect to PostgreSQL using GORM: %v\", err)\n\t}\n\n\t// Perform operations with dbSQL or dbGORM\n}\n```\n\n## GopherToken\n\n**Package:** `gophertoken`\n\n### About\n\nThe `gophertoken` package provides a framework for token management using JWT and Paseto, supporting token generation and validation with expiration logic. It offers interfaces for both types and implements payload structures, allowing developers to manage token-based authentication.\n\n### Payload Structure\n\n#### `Payload`\nRepresents the token's claims, containing user information and expiration details.\n\n**Fields:**\n- `ID`: A unique token ID (`uuid.UUID`).\n- `Username`: The username associated with the token.\n- `IssuedAt`: The time when the token was issued.\n- `ExpiredAt`: The expiration time of the token.\n\n### Errors\n- `ErrInvalidToken`: Indicates that the token is invalid.\n- `ErrExpiredToken`: Indicates that the token has expired.\n\n### Methods\n\n#### `NewPayload(username, duration)`\nCreates a new `Payload` for a given user and token duration.\n\n**Parameters:**\n- `username`: The username for the token.\n- `duration`: Token validity period (e.g., 1 hour).\n\n**Returns:**\n- `*Payload`: The payload object containing user information and expiration data.\n- `error`: If there's an issue during payload creation.\n\n#### `Valid()`\nValidates if the token has expired.\n\n**Returns:**\n- `error`: `ErrExpiredToken` if the token is expired, or `nil` if valid.\n\n### TokenManager Interface\n\n#### `TokenManager`\nInterface for token operations like generation and validation, supporting JWT and Paseto tokens.\n\n**Methods:**\n- `GenerateToken(username string, duration time.Duration) (string, error)`: Generates a token.\n- `ValidateToken(token string) (*Payload, error)`: Validates a token and returns its payload.\n\n### Implementations\n\n#### `NewTokenManager(tokenType, secretKey)`\nInstantiates a new `TokenManager` based on the provided token type (`\"jwt\"` or `\"paseto\"`) and a secret key.\n\n**Parameters:**\n- `tokenType`: Either `\"jwt\"` or `\"paseto\"`.\n- `secretKey`: The secret key used for signing the token.\n\n**Returns:**\n- `TokenManager`: A token manager that supports the specified token type.\n- `error`: If the token type is unsupported or the secret key is invalid.\n\n---\n\n### JWT Implementation\n\n#### `JWTMaker`\nHandles JWT token creation and validation.\n\n##### `NewJWTMaker(secretKey)`\nCreates a new `JWTMaker` for JWT tokens.\n\n**Parameters:**\n- `secretKey`: Secret key for signing JWTs.\n\n**Returns:**\n- `*JWTMaker`: The JWT manager.\n- `error`: If the secret key is invalid.\n\n##### `GenerateToken(username, duration)`\nGenerates a JWT with a specific username and duration.\n\n**Returns:**\n- `string`: The JWT as a string.\n- `error`: If there's an error during token generation.\n\n##### `ValidateToken(tokenString)`\nValidates the JWT and returns its payload.\n\n**Returns:**\n- `*Payload`: The token's payload.\n- `error`: If the token is invalid or expired.\n\n---\n\n### Paseto Implementation\n\n#### `PasetoMaker`\nHandles Paseto token creation and validation.\n\n##### `NewPasetoMaker(secretKey)`\nCreates a new `PasetoMaker` for Paseto tokens.\n\n**Parameters:**\n- `secretKey`: Symmetric key for Paseto (must be 32 bytes).\n\n**Returns:**\n- `*PasetoMaker`: The Paseto manager.\n- `error`: If the secret key is invalid.\n\n##### `GenerateToken(username, duration)`\nGenerates a Paseto token with a specific username and duration.\n\n**Returns:**\n- `string`: The Paseto token.\n- `error`: If token generation fails.\n\n##### `ValidateToken(token)`\nValidates the Paseto token and returns its payload.\n\n**Returns:**\n- `*Payload`: The token's payload.\n- `error`: If the token is invalid or expired.\n\n---\n\n### Example Usage (JWT)\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/lordofthemind/mygopher/gophertoken\"\n)\n\nfunc main() {\n\tmanager, err := gophertoken.NewTokenManager(\"jwt\", \"your-secret-key\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create JWT manager: %v\", err)\n\t}\n\n\ttoken, err := manager.GenerateToken(\"user123\", time.Hour)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to generate token: %v\", err)\n\t}\n\n\tlog.Println(\"Generated Token:\", token)\n\n\tpayload, err := manager.ValidateToken(token)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to validate token: %v\", err)\n\t}\n\n\tlog.Printf(\"Token Payload: %+v\\n\", payload)\n}\n```\n\n---\n\n### License\n\nThis repository is licensed under the MIT License. The full text of the license is as follows:\n\n---\n\n**MIT License**\n\nCopyright (c) 2024 Manish Kumar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---\n\n### Contributing\n\nWe welcome contributions to the **MyGopher** repository. To contribute:\n\n1. **Report Issues**: If you find any bugs or have feature requests, please open an issue on the [GitHub Issues page](#).\n2. **Submit Pull Requests**: For code contributions, fork the repository, make your changes, and submit a pull request. Ensure your changes adhere to the existing code style and include appropriate tests if applicable.\n\nPlease follow our [contributing guidelines](#) to ensure a smooth collaboration process.\n\n---\n\n### Documentation Overview\n\nThis documentation provides a comprehensive overview and detailed usage examples for each package within the **MyGopher** repository. It is intended to help developers understand the functionalities of the packages and how to integrate them into their projects effectively. The documentation is organized as follows:\n\n- **gophergin**: Setup and configuration of the Gin server with optional CORS and TLS support.\n- **gophermongo**: Utilities for connecting to MongoDB, accessing collections, and managing databases.\n- **gopherpostgres**: Tools for connecting to PostgreSQL using both `database/sql` and GORM.\n- **gophertoken**: Token management utilities including JWT and Paseto implementations.\n\nAs the project evolves, this documentation will be updated with new features, changes, and best practices. Feel free to contribute suggestions and improvements.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordofthemind%2Fmygopher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flordofthemind%2Fmygopher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordofthemind%2Fmygopher/lists"}