Documentation ¶
Index ¶
- func InitProf(engine *GinEngine)
- func InitSession()
- func InitWeb()
- type EntitySessions
- type GinEngine
- func (domain *GinEngine) GetXXHandler(handler XXHandlerFunc) gin.HandlerFunc
- func (domain *GinEngine) With404JSON() *GinEngine
- func (domain *GinEngine) WithCors(allowHeaders ...string) *GinEngine
- func (domain *GinEngine) WithLogger() *GinEngine
- func (domain *GinEngine) WithMiddleware(listens ...gin.RecoveryFunc) *GinEngine
- func (domain *GinEngine) XXDel(relativePath string, handler XXHandlerFunc)
- func (domain *GinEngine) XXGet(relativePath string, handler XXHandlerFunc)
- func (domain *GinEngine) XXHandler(httpMethod, relativePath string, handler XXHandlerFunc)
- func (domain *GinEngine) XXLoader(loaders ...LoaderHandler)
- func (domain *GinEngine) XXPost(relativePath string, handler XXHandlerFunc)
- func (domain *GinEngine) XXPut(relativePath string, handler XXHandlerFunc)
- func (domain *GinEngine) XXRun()
- type LoaderHandler
- type MysqlStore
- type RedisStore
- type ResultFunc
- type SessionCtx
- type SessionCtxDefault
- type SessionCtxFunc
- type XXHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitSession ¶
func InitSession()
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 (*GinEngine) WithLogger ¶ added in v0.0.8
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)
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) 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) 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
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)
Click to show internal directories.
Click to hide internal directories.