ctxmgr

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDb added in v0.0.6

func AddDb(s string, db *gorm.DB)

func DB added in v0.0.6

func DB() *gorm.DB

func DBN added in v0.0.6

func DBN(s string) *gorm.DB

func Db

func Db(c context.Context) (ret *gorm.DB, err error)

Db returns a *gorm.DB based on tenant queried from ctx

func Done

func Done(c context.Context) func()

Done returns a func() stored on ctx under the key model.CTX_DONE

func Err

func Err(c context.Context, err error) bool

Err responds the request stored on ctx with err.Error() and status http.StatusInternalServerError

func Req

func Req(c context.Context) *http.Request

func Res

Res returns http.ResponseWriter stored on ctx under key model.CTX_RES

func Session

func Session(c context.Context) *fmodel.Session

func SessionID

func SessionID(c context.Context) string

SessionID returns the session identifier of the request stored on context

func SetDefaultDB added in v0.0.6

func SetDefaultDB(db *gorm.DB)

func Tenant

func Tenant(c context.Context) string

Tenant returns the tenant defined in model.Session stored on ctx

func Vars

func Vars(c context.Context) map[string]string

Vars returns the mux.Vars from the *http.Request stored on ctx

Types

This section is empty.

Jump to

Keyboard shortcuts

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