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: 0

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