mweb

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: GPL-3.0 Imports: 25 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()

Types

type EntitySessions added in v0.1.4

type EntitySessions struct {
	SessionId  string     `db:"session_id"`
	ServerName string     `db:"server_name"`
	Value      string     `db:"value"`
	Expire     *time.Time `db:"expire"`
}

EntitySessions drop table if exists tb_sessions; create table tb_sessions ( session_id varchar(255) not null primary key comment 'sessionId', server_name varchar(60) not null , value longtext not null comment '值', expire datetime not null comment '超时时间', key(server_name) ) comment 'gin session表';

func (*EntitySessions) IdName added in v0.1.4

func (ce *EntitySessions) IdName() string

func (*EntitySessions) IdVal added in v0.1.4

func (ce *EntitySessions) IdVal() any

func (*EntitySessions) TableName added in v0.1.4

func (ce *EntitySessions) TableName() string

type GinEngine added in v0.0.8

type GinEngine struct {
	*gin.Engine
	BasePath  string
	SessionId string
	Port      int64
	Stx       SessionCtxFunc
	ResFunc   ResultFunc
}
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 *mdb.SQLExecute
	Codecs      []securecookie.Codec
	// contains filtered or unexported fields
}

func NewMysqlStore added in v0.1.4

func NewMysqlStore(mysqlClient *mdb.SQLExecute, 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 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