gorm

command module
v0.0.0-...-1d7f533 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 21 Imported by: 0

README

Example project

combination of jace996,gin,gorm(sqlite/mysql)

sqlite3
go run github.com/jace996/saas/examples/gorm

mysql
docker-compose up -d
go run github.com/jace996/saas/examples/gorm --driver mysql

postgres
docker-compose up -d
go run github.com/jace996/saas/examples/gorm --driver pgx

Host side ( use shared database):

Open http://localhost:8090/posts


Multi-tenancy ( use shared database):

Open http://localhost:8090/posts?__tenant=1

Open http://localhost:8090/posts?__tenant=2


Single-tenancy ( use separate database):

Open http://localhost:8090/posts?__tenant=3


Create tenant

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"name":"newTenant","separateDb":true}' http://localhost:8090/tenant

Open http://localhost:8090/posts?__tenant=newTenant

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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