mweb

package
v0.4.67 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitProf added in v0.1.2

func InitProf(engine *GinEngine)

func InitSession

func InitSession()

func InitWeb

func InitWeb()

func NewRedirectFileServer added in v0.2.9

func NewRedirectFileServer(fs embed.FS, prefix []string) func(ctx *gin.Context)

Types

type EntitySessions added in v0.1.4

type EntitySessions struct {
	ID          int64      `xorm:"pk id autoincr bigint(20) notnull comment('id') "`
	SessionId   string     `xorm:"varchar(255) key('session_id') comment('sessionId')" json:"sessionId"`
	ServerName  string     `xorm:"varchar(255) comment('服务名称')" json:"serverName"`
	ContentType string     `xorm:"varchar(1000) comment('请求头')" json:"ContentType"`
	Value       string     `xorm:"varchar(500) comment('值')" json:"value"`
	Expire      *time.Time `xorm:"varchar(500) comment('过期时间')" json:"expire"`
	CreateTime  *time.Time `xorm:"created varchar(500) comment('创建时间')" json:"CreateTime"`
	UpdateTime  *time.Time `xorm:"updated created varchar(500) comment('修改时间')" json:"UpdateTime"`
}

func (*EntitySessions) TableName added in v0.1.4

func (ce *EntitySessions) TableName() string

type ErrorHandler added in v0.3.0

type ErrorHandler func(err error, stx SessionCtx, ctx *gin.Context)

type GinEngine added in v0.0.8

type GinEngine struct {
	*gin.Engine
	BasePath   string
	SessionId  string
	Port       int64
	Stx        SessionCtxFunc
	ResFunc    ResultFunc
	ErrHandler ErrorHandler
}
var Engine *GinEngine

func (*GinEngine) GetXXHandler added in v0.0.8

func (domain *GinEngine) GetXXHandler(handler XXHandlerFunc) gin.HandlerFunc

func (*GinEngine) With404JSON added in v0.0.8

func (domain *GinEngine) With404JSON() *GinEngine

func (*GinEngine) WithCors added in v0.0.8

func (domain *GinEngine) WithCors(allowHeaders ...string) *GinEngine

func (*GinEngine) WithLogger added in v0.0.8

func (domain *GinEngine) WithLogger() *GinEngine

func (*GinEngine) WithMiddleware added in v0.0.8

func (domain *GinEngine) WithMiddleware(listens ...gin.RecoveryFunc) *GinEngine

func (*GinEngine) XXDel added in v0.0.8

func (domain *GinEngine) XXDel(relativePath string, handler XXHandlerFunc)

func (*GinEngine) XXGet added in v0.0.8

func (domain *GinEngine) XXGet(relativePath string, handler XXHandlerFunc)

func (*GinEngine) XXHandler added in v0.0.8

func (domain *GinEngine) XXHandler(httpMethod, relativePath string, handler XXHandlerFunc)

func (*GinEngine) XXLoader added in v0.0.8

func (domain *GinEngine) XXLoader(loaders ...LoaderHandler)

func (*GinEngine) XXPost added in v0.0.8

func (domain *GinEngine) XXPost(relativePath string, handler XXHandlerFunc)

func (*GinEngine) XXPut added in v0.0.8

func (domain *GinEngine) XXPut(relativePath string, handler XXHandlerFunc)

func (*GinEngine) XXRun added in v0.0.8

func (domain *GinEngine) XXRun()

type LoaderHandler added in v0.0.8

type LoaderHandler interface {
	Loader(engine *GinEngine)
}

type MysqlStore added in v0.1.4

type MysqlStore struct {
	Options     *sessions.Options
	MySqlClient *xorm.Engine
	Codecs      []securecookie.Codec
	// contains filtered or unexported fields
}

func NewMysqlStore added in v0.1.4

func NewMysqlStore(mysqlClient *xorm.Engine, prefix string, keyPairs ...[]byte) *MysqlStore

func (*MysqlStore) Get added in v0.1.4

func (domain *MysqlStore) Get(r *http.Request, name string) (*sessions.Session, error)

func (*MysqlStore) New added in v0.1.4

func (domain *MysqlStore) New(r *http.Request, name string) (*sessions.Session, error)

func (*MysqlStore) Save added in v0.1.4

func (domain *MysqlStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

type RedirectFileServer added in v0.2.9

type RedirectFileServer struct {
	FS      embed.FS
	Dir     string
	Ignore  []string
	Adapter func(ctx *gin.Context) bool
}

func (RedirectFileServer) Create added in v0.2.9

func (ew RedirectFileServer) Create() func(ctx *gin.Context)

type RedisStore

type RedisStore struct {
	Options     *sessions.Options
	RedisClient *redis.Client
	Codecs      []securecookie.Codec
	// contains filtered or unexported fields
}

func NewRedisStore

func NewRedisStore(redisClient *redis.Client, prefix string, keyPairs ...[]byte) *RedisStore

func (*RedisStore) Get

func (domain *RedisStore) Get(r *http.Request, name string) (*sessions.Session, error)

func (*RedisStore) New

func (domain *RedisStore) New(r *http.Request, name string) (*sessions.Session, error)

func (*RedisStore) Save

func (domain *RedisStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

type ResultFunc added in v0.0.6

type ResultFunc func(stx SessionCtx, ctx *gin.Context, result any, err error)

type SessionCtx added in v0.0.6

type SessionCtx interface {
	GetSession() (*sessions.Session, error)
	Save()
}

SessionCtx Stx 此处是获取session 的前置句柄,如需要对session进行安全验证操作请在初始化完成后覆盖

type SessionCtxDefault added in v0.0.6

type SessionCtxDefault struct {
	// contains filtered or unexported fields
}

func (*SessionCtxDefault) GetSession added in v0.0.6

func (domain *SessionCtxDefault) GetSession() (*sessions.Session, error)

func (*SessionCtxDefault) Save added in v0.0.6

func (domain *SessionCtxDefault) Save()

type SessionCtxFunc added in v0.0.6

type SessionCtxFunc func(ctx *gin.Context) SessionCtx

type XXHandlerFunc

type XXHandlerFunc func(stx SessionCtx, ctx *gin.Context) (result any, err error)

Jump to

Keyboard shortcuts

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