Documentation
¶
Index ¶
- Variables
- func FromCtx(ctx context.Context) *gorm.DB
- func Init(c *Config)
- func InjectCtx(ctx context.Context, db *gorm.DB) context.Context
- func MysqlMigrate(ctx context.Context, tenants ...string) error
- func PGMigrate(ctx context.Context, tenants ...string) error
- func RegisterModel(m interface{}, initialValue ...interface{})
- func SessionCtx(ctx context.Context) context.Context
- func SessionHandler(next http.Handler) http.Handler
- func WithPagenation(pageNum int, pageSize int) func(db *gorm.DB) *gorm.DB
- func WithTenant(tenant string, m interface{}) func(db *gorm.DB) *gorm.DB
- type Config
- type ContextKey
- type Model
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DBXContext ContextKey = "dbx-context" SQLLiteType = "sqllite" MysqlType = "mysql" PostgresType = "postgres" DB *gorm.DB )
Functions ¶
func MysqlMigrate ¶ added in v0.1.14
func RegisterModel ¶
func RegisterModel(m interface{}, initialValue ...interface{})
func WithPagenation ¶ added in v0.1.14
WithPagenation build the gorm condition with page_num and page_size the page_num start from 1
Types ¶
type ContextKey ¶
type ContextKey string
Click to show internal directories.
Click to hide internal directories.