Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#35 package docs): pkg doc files #37

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions pkg/email/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Package email provides functionality for sending emails.
//
// This package defines an interface for email services, allowing for different implementations.
// The default implementation uses the SendGrid service to send emails.
//
// In your main.go or application initialization file, you can initialize the email service like this:
//
// package main
//
// import (
// "github.com/Zapharaos/fihub-backend/pkg/email"
// )
//
// func main() {
// // Initialize the email service
// emailService := email.NewSendgridService()
//
// // Replace the global email service instance
// email.ReplaceGlobals(emailService)
// }
//
// To send an email:
//
// err := service.Send("[email protected]", "Subject", "Plain text content", "HTML content")
//
// For more information, see the documentation for the SendGrid library.
package email
31 changes: 31 additions & 0 deletions pkg/email/templates/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Package templates provides functionality for managing email templates.
//
// This package provides a main HTML email layout. Multiple content templates can be created
// to be used as the main item inside the initial email layout.
//
// Usage:
//
// To define the main HTML content and set up its structure:
//
// htmlContentTemplate := templates.NewCustomTemplate(templates.CustomData{
// Field1: "Hello",
// Field2: "$123456789",
// Field3: "29/01/2025",
// })
//
// To set the variables for the initial email layout:
//
// labels := templates.LayoutLabels{
// Help: "Help",
// Copyrights: "Copyrights",
// }
//
// To build the full email HTML content with the specified data:
//
// htmlContent, err := htmlContentTemplate.Build(labels)
// if err != nil {
// // Handle error
// }
//
// For more information, see the documentation for the text/template and html/template packages.
package templates
32 changes: 32 additions & 0 deletions pkg/env/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Package env provides utilities for loading and retrieving environment variables.
//
// This package offers functions to load environment variables from a `.env` file and retrieve them
// as different types such as string, integer, boolean, and duration.
//
// Usage:
//
// To load environment variables from a `.env` file:
//
// err := env.Load()
// if err != nil {
// log.Fatal("Error loading .env file")
// }
//
// To retrieve an environment variable as a string:
//
// value := env.GetString("KEY", "default")
//
// To retrieve an environment variable as an integer:
//
// value := env.GetInt("KEY", 42)
//
// To retrieve an environment variable as a boolean:
//
// value := env.GetBool("KEY", true)
//
// To retrieve an environment variable as a duration:
//
// value := env.GetDuration("KEY", time.Second)
//
// For more information, see the documentation for the `github.com/joho/godotenv` library.
package env
30 changes: 30 additions & 0 deletions pkg/translation/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Package translation provides functionality for internationalization and localization.
//
// This package defines an interface for translation services, allowing for different implementations.
// The default implementation uses the go-i18n library to manage translations and localize messages.
// It supports multiple languages and allows for easy addition of new translations.
//
// In your main.go or application initialization file, you can initialize the translation service like this:
//
// package main
//
// import (
// "github.com/Zapharaos/fihub-backend/pkg/translation"
// "golang.org/x/text/language"
// )
//
// func main() {
// // Initialize the translation service
// translationService := translation.NewI18nService(language.English)
//
// // Replace the global translation service instance
// translation.ReplaceGlobals(translationService)
// }
//
// To get a localized message:
//
// localizer, _ := translation.S().Localizer(language.French)
// message := translation.S().Message(localizer, &translation.Message{ID: "HelloWorld"})
//
// For more information, see the documentation for the go-i18n library.
package translation