gin-shared

module
v0.12.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: MIT

README

gin-shared

A comprehensive Go module that integrates Gin, Viper, Uber Dig (dependency injection), Zap logging, and Prometheus monitoring.

Overview

This module provides a collection of reusable packages for building production-ready Go web applications with best practices built-in.

Package Structure

Core Infrastructure
  • pkg/core - Dependency injection, event bus, configuration management, and application lifecycle
  • pkg/ginshared - Gin web framework utilities, middleware, and server initialization
Authentication & Security
  • pkg/auth - API key authentication and user management
  • pkg/keycloak - Keycloak IAM integration for OAuth2/OIDC
Data & Storage
  • pkg/orm - Database abstraction with GORM (MySQL, PostgreSQL, SQLite, SQL Server)
  • pkg/dedup - Object deduplication and MD5 fingerprinting
  • pkg/query - Flexible SQL query execution with dynamic WHERE and paging
  • pkg/cache - Generic caching system with RAM and Redis providers
  • pkg/storage - Unified filesystem abstraction (Local, OSS, SFTP)
Messaging & Communication
Data Processing
  • pkg/parquet - Parquet file writing for efficient data storage
Scheduling
  • pkg/schedule - Cron job scheduling with database persistence
Notifications
Utilities
  • pkg/types - Custom type definitions (DateTime with JSON support)

Key Features

  • Dependency Injection: Built on Uber's Dig for clean architecture
  • Multi-Database Support: MySQL, PostgreSQL, SQLite, SQL Server
  • Caching: RAM and Redis cache providers
  • Monitoring: Prometheus metrics integration
  • Logging: Structured logging with Zap
  • Configuration: Viper-based configuration with encryption
  • Security: API key auth, Keycloak integration, CORS, HTTPS
  • Messaging: Redis streaming, MQTT support
  • Storage: Local, OSS, SFTP filesystem abstraction

Quick Start

package main

import (
    "github.com/techquest-tech/gin-shared/pkg/core"
    "github.com/techquest-tech/gin-shared/pkg/ginshared"
    "github.com/techquest-tech/gin-shared/pkg/orm"
)

func main() {
    // Register your services
    core.Provide(NewMyService)
    
    // Start the application
    ginshared.Start()
}

Configuration

Configure via Viper (config.yaml, ENV, etc.):

database:
  type: mysql
  connection: "user:pass@tcp(localhost:3306)/db"
  maxLifetime: 1h
  max: 100
  idel: 10
  initDB: true

address: :5001
baseUri: /v1

Dependencies

License

MIT License

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL