Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/bartventer/gorm-multitenancy/v8

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/bartventer/gorm-multitenancy/v8

  • v8.7.2
  • Source
  • Go
  • Socket score

Version published
Created
Source

gorm-multitenancy

Mentioned in Awesome Go Go Reference Release Go Report Card codecov Tests GitHub issues License

GORM Multitenancy

Photo by Ashley McNamara, via ashleymcnamara/gophers (CC BY-NC-SA 4.0)

Overview

Gorm-multitenancy provides a Go framework for building multi-tenant applications, streamlining tenant management and model migrations. It abstracts multitenancy complexities through a unified, database-agnostic API compatible with GORM.

Multitenancy Approaches

There are three common approaches to multitenancy in a database:

  • Shared database, shared schema
  • Shared database, separate schemas
  • Separate databases

Depending on the database in use, this package utilizes either the "shared database, separate schemas" or "separate databases" strategy, ensuring a smooth integration with your existing database configuration through the provision of tailored drivers.

Features

  • GORM Integration: Simplifies GORM usage in multi-tenant environments, offering a unified API alongside direct access to driver-specific APIs for flexibility.
  • Custom Database Drivers: Enhances existing drivers for easy multitenancy setup without altering initialization.
  • HTTP Middleware: Provides middleware for easy tenant context management in web applications.

Supported Databases

DatabaseApproach
PostgreSQLShared database, separate schemas
MySQLSeparate databases

Router Integration

Installation

Install the core package:

go get -u github.com/bartventer/gorm-multitenancy/v8

Install the database-specific driver:

# PostgreSQL
go get -u github.com/bartventer/gorm-multitenancy/postgres/v8

# MySQL
go get -u github.com/bartventer/gorm-multitenancy/mysql/v8

Optionally, install the router-specific middleware:

# Echo
go get -u github.com/bartventer/gorm-multitenancy/middleware/echo/v8

# Gin
go get -u github.com/bartventer/gorm-multitenancy/middleware/gin/v8

# Iris
go get -u github.com/bartventer/gorm-multitenancy/middleware/iris/v8

# Net/HTTP
go get -u github.com/bartventer/gorm-multitenancy/middleware/nethttp/v8

Getting Started

Check out the pkg.go.dev documentation for comprehensive guides and API references.

Running the Example Application

For a practical demonstration, you can run the example application. It showcases various configurations and usage scenarios.

Contributing

All contributions are welcome! See the Contributing Guide for more details.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

FAQs

Package last updated on 19 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc