gorm

command module
v0.0.0-...-ad56753 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 21 Imported by: 0

README

Example project

combination of go-saas,gin,gorm(sqlite/mysql)

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

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

postgres
docker-compose up -d
go run github.com/go-saas/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