webui

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessKeyUserID = "uid"
)

SessKeyUserID type of session key

Variables

This section is empty.

Functions

func Action

func Action(ctx *Context)

ExportObject export object

func GetContextHandler

func GetContextHandler() macaron.Handler

GetContextHandler get context handler

func HealthCluster

func HealthCluster(ctx *Context)

func HealthID

func HealthID(ctx *Context)

func NewAPI

func NewAPI(m *macaron.Macaron) error

NewAPICfgImportExport Import/Export REST API creator

func QueryActive

func QueryActive(ctx *Context)

func Sessioner

func Sessioner(options session.Options) macaron.Handler

Sessioner return a Macaron handler

func SetConfDir

func SetConfDir(dir string)

SetConfDir et dir for logs

func SetLogDir

func SetLogDir(dir string)

SetLogDir et dir for logs

func SetLogger

func SetLogger(l *logrus.Logger)

SetLogger set output log

func WebServer

func WebServer(publicPath string, bindAddr string, cfg *config.HTTPConfig, id string)

WebServer the main process

Types

type Context

type Context struct {
	*macaron.Context
	SignedInUser string
	Session      SessionStore
	IsSignedIn   bool
}

Context custom context for http session handler

func (*Context) RawAsJSON

func (ctx *Context) RawAsJSON(status int, json []byte)

RawAsJSON raw to json conversion

type SessionStore

type SessionStore interface {
	// Set sets value to given key in session.
	Set(interface{}, interface{}) error
	// Get gets value by given key in session.
	Get(interface{}) interface{}
	// ID returns current session ID.
	ID() string
	// Release releases session resource and save data to provider.
	Release() error
	// Destory deletes a session.
	Destory(*Context) error
	// init
	Start(*Context) error
}

SessionStore Session Interface

func GetSession

func GetSession() SessionStore

GetSession get session store

type SessionWrapper

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

SessionWrapper session wrapper

func (*SessionWrapper) Destory

func (s *SessionWrapper) Destory(c *Context) error

Destory destory session

func (*SessionWrapper) Get

func (s *SessionWrapper) Get(k interface{}) interface{}

Get session Key/Value getter

func (*SessionWrapper) ID

func (s *SessionWrapper) ID() string

ID get session identificator

func (*SessionWrapper) Release

func (s *SessionWrapper) Release() error

Release session release

func (*SessionWrapper) Set

func (s *SessionWrapper) Set(k interface{}, v interface{}) error

Set session key/value setter

func (*SessionWrapper) Start

func (s *SessionWrapper) Start(c *Context) error

Start start session context

type UserLogin

type UserLogin struct {
	UserName string `form:"username" binding:"Required"`
	Password string `form:"password" binding:"Required"`
}

UserLogin for login purposes

Jump to

Keyboard shortcuts

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