Documentation
¶
Index ¶
- Constants
- Variables
- func Enhance(app *view.HTMLEngine)
- func Index(arr, value interface{}) int
- func Page(ctx *Context, total int64, showTotal bool, classes string) string
- func ParseTimeLocal(format, date string) (time.Time, error)
- func Render(app iris.Party, path string, html string, param ...interface{})
- func Rewrite(app iris.Party, from string, to string, statusCode ...int)
- func SendHtml(app iris.Party, path string, html string) error
- func SessionFilter(ctx iris.Context)
- type BreadCrumb
- type Context
- func (ctx *Context) AddParamError(key, msg string)
- func (ctx *Context) AppendViewData(key string, values ...string)
- func (ctx *Context) Check()
- func (ctx *Context) CheckBody(field string) *Validator
- func (ctx *Context) CheckBodyValues(field string) *ValidatorValues
- func (ctx *Context) CheckFile(field string) *ValidatorFile
- func (ctx *Context) CheckPath(field string) *Validator
- func (ctx *Context) CheckQuery(field string) *Validator
- func (ctx *Context) Css(css ...string)
- func (ctx *Context) Do(handlers context.Handlers)
- func (ctx *Context) Err(status int, data interface{})
- func (ctx *Context) Get(key string) interface{}
- func (ctx *Context) Js(js ...string) string
- func (ctx *Context) Next()
- func (ctx *Context) Ok(data interface{})
- func (ctx *Context) OkPage(data interface{}, total int64, pageIndex, pageSize int)
- func (ctx *Context) OkPageDefault(data interface{}, total int64)
- func (ctx *Context) PathIndex(i int) string
- func (ctx *Context) PathLeft(count int) string
- func (ctx *Context) PathMatch(pattern string) bool
- func (ctx *Context) PathMid(start, length int) string
- func (ctx *Context) PathParent() string
- func (ctx *Context) PathRight(count int) string
- func (ctx *Context) ProxyPass(proxy, path string) error
- func (ctx *Context) PushBreadCrumb(title, url string)
- func (ctx *Context) QueryString() string
- func (ctx *Context) ReadValidate(form interface{}) bool
- func (ctx *Context) Redirect(urlToRedirect string, statusHeader ...int)
- func (ctx *Context) RedirectSignin(needRedirectFrom bool)
- func (ctx *Context) RedirectWithFrom(uri string)
- func (ctx *Context) RemoveCookieLocal(key string)
- func (ctx *Context) ReturnJson() bool
- func (ctx *Context) Script(js string) string
- func (ctx *Context) Set(key string, v interface{}) string
- func (ctx *Context) SetCookieLocal(key, value string, maxAge int, httpOnly bool)
- func (ctx *Context) SetReturnHtml()
- func (ctx *Context) SetReturnJson()
- func (ctx *Context) Signout()
- func (ctx *Context) Title(title string)
- func (ctx *Context) View(filename string, optionalViewModel ...interface{}) error
- type JqueryUploadFile
- type JqueryUploadResult
- type PageData
- type SaveFileResult
- type Select2
- type Session
- func (s *Session) Destroy()
- func (s Session) Get(key string, result interface{})
- func (s Session) GetInt(key string) int
- func (s Session) GetString(key string) string
- func (s *Session) Refresh()
- func (s *Session) Remove(key string)
- func (s *Session) Set(key string, value interface{})
- func (s *Session) SetUid(uid int)
- func (s *Session) Uid() int
- type SessionOptions
- type Validator
- func (v *Validator) Bool(dv bool, msg ...string) bool
- func (v *Validator) ByteLen(min, max int, msg ...string) *Validator
- func (v *Validator) Date(dv time.Time, msg ...string) time.Time
- func (v *Validator) DateFormat(format string, dv time.Time, msg ...string) time.Time
- func (v *Validator) DateTime(dv time.Time, msg ...string) time.Time
- func (v *Validator) DateTimeShort(dv time.Time, msg ...string) time.Time
- func (v *Validator) Empty(msg ...string) *Validator
- func (v *Validator) Ensure(assertion, shouldBail bool, msg ...string) *Validator
- func (v *Validator) EnsureNot(assertion, shouldBail bool, msg ...string) *Validator
- func (v *Validator) Exist(msg ...string) *Validator
- func (v *Validator) Float(dv float64, msg ...string) float64
- func (v *Validator) Float32(dv float32, msg ...string) float32
- func (v *Validator) In(values []string, msg ...string) *Validator
- func (v *Validator) InInts(values []int, msg ...string) *Validator
- func (v *Validator) Int(dv int, msg ...string) int
- func (v *Validator) Int64(dv int64, msg ...string) int64
- func (v *Validator) IsASCII(msg ...string) *Validator
- func (v *Validator) IsAlpha(msg ...string) *Validator
- func (v *Validator) IsAlphanumeric(msg ...string) *Validator
- func (v *Validator) IsBool(msg ...string) *Validator
- func (v *Validator) IsEmail(msg ...string) *Validator
- func (v *Validator) IsFilePath(msg ...string) *Validator
- func (v *Validator) IsFloat(msg ...string) *Validator
- func (v *Validator) IsIP(msg ...string) *Validator
- func (v *Validator) IsInt(msg ...string) *Validator
- func (v *Validator) IsJSON(msg ...string) *Validator
- func (v *Validator) IsLowerCase(msg ...string) *Validator
- func (v *Validator) IsNumeric(msg ...string) *Validator
- func (v *Validator) IsTime(format string, msg ...string) *Validator
- func (v *Validator) IsUpperCase(msg ...string) *Validator
- func (v *Validator) IsUrl(msg ...string) *Validator
- func (v *Validator) Json(r interface{}, msg ...string)
- func (v *Validator) Len(min, max int, msg ...string) *Validator
- func (v *Validator) Match(reg string, msg ...string) *Validator
- func (v *Validator) NotBlank(msg ...string) *Validator
- func (v *Validator) NotEmpty(msg ...string) *Validator
- func (v *Validator) NotMatch(reg string, msg ...string) *Validator
- func (v *Validator) Optional() *Validator
- func (v *Validator) Present() bool
- func (v *Validator) SanitizeHtml() string
- func (v *Validator) String(dv ...string) string
- func (v *Validator) Time(dv time.Time, msg ...string) time.Time
- func (v *Validator) TimeShort(dv time.Time, msg ...string) time.Time
- func (v *Validator) Trim() *Validator
- type ValidatorFile
- func (v *ValidatorFile) Copy(dstFile string)
- func (v *ValidatorFile) Empty(msg ...string) *ValidatorFile
- func (v *ValidatorFile) ExtIn(exts []string, msg ...string) *ValidatorFile
- func (v *ValidatorFile) IsImage(msg ...string) *ValidatorFile
- func (v *ValidatorFile) Len(min, max int64, msg ...string) *ValidatorFile
- func (v *ValidatorFile) NotEmpty(msg ...string) *ValidatorFile
- func (v *ValidatorFile) Optional() *ValidatorFile
- type ValidatorValues
- func (v *ValidatorValues) Empty(msg ...string) *ValidatorValues
- func (v *ValidatorValues) Ensure(assertion, shouldBail bool, msg ...string) *ValidatorValues
- func (v *ValidatorValues) EnsureNot(assertion, shouldBail bool, msg ...string) *ValidatorValues
- func (v *ValidatorValues) Float32(dv []float32, msg ...string) []float32
- func (v *ValidatorValues) Floats(dv []float64, msg ...string) []float64
- func (v *ValidatorValues) Ints(dv []int, msg ...string) []int
- func (v *ValidatorValues) Len(min, max int, msg ...string) *ValidatorValues
- func (v *ValidatorValues) Match(reg string, msg ...string) *ValidatorValues
- func (v *ValidatorValues) NotEmpty(msg ...string) *ValidatorValues
- func (v *ValidatorValues) NotMatch(reg string, msg ...string) *ValidatorValues
- func (v *ValidatorValues) Optional() *ValidatorValues
- func (v *ValidatorValues) Strings(dv []string, msg ...string) []string
Constants ¶
View Source
const (
TypeCastError = 1 + iota
)
Variables ¶
View Source
var GetUidByToken func(token string, tokenType int) int
View Source
var RedisClient *rediswrap.Redis
View Source
var SessionCookieDomain string
View Source
var SessionCookieId string = "sessionid"
View Source
var SessionCookieTokenId string = "sessiontoken" //网页记住我
View Source
var SessionCookieTokenTtl int = 30 * 24 * 3600 //网页记住我的时长
View Source
var SessionCookieTtl int = 30 * 60
View Source
var SessionHeaderId = "X-USER-TOKEN"
View Source
var SessionUidKey string = "UID"
Functions ¶
func SessionFilter ¶
Types ¶
type BreadCrumb ¶
type Context ¶
type Context struct {
context.Context
// session *sessions.Session
PageSize int
AutoIncludeCss bool
AutoIncludeJs bool
AutoHead bool
// Owner table.User
// Error *errors.PageError
ParamErrors map[string]string
BreadCrumbs []BreadCrumb
Scripts []string
// uid int
Session *Session
// contains filtered or unexported fields
}
type H map[string]interface{}
func (*Context) AddParamError ¶
func (*Context) AppendViewData ¶
func (*Context) CheckBodyValues ¶
func (ctx *Context) CheckBodyValues(field string) *ValidatorValues
func (*Context) CheckFile ¶
func (ctx *Context) CheckFile(field string) *ValidatorFile
func (*Context) CheckQuery ¶
func (*Context) OkPageDefault ¶
func (*Context) PathParent ¶
func (*Context) PushBreadCrumb ¶
func (*Context) QueryString ¶
func (*Context) ReadValidate ¶
func (*Context) RedirectSignin ¶
func (*Context) RedirectWithFrom ¶
func (*Context) RemoveCookieLocal ¶
func (*Context) ReturnJson ¶
func (*Context) SetCookieLocal ¶
func (*Context) SetReturnHtml ¶
func (ctx *Context) SetReturnHtml()
func (*Context) SetReturnJson ¶
func (ctx *Context) SetReturnJson()
type JqueryUploadFile ¶
type JqueryUploadResult ¶
type JqueryUploadResult struct {
Files []JqueryUploadFile `json:"files"`
}
func NewJqueryUploadResult ¶
func NewJqueryUploadResult(name string, size int64, err string) JqueryUploadResult
type SaveFileResult ¶
type SaveFileResult struct {
Url string
Header *multipart.FileHeader
Error error
}
type Session ¶
type SessionOptions ¶
type SessionOptions struct {
}
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func (*Validator) DateFormat ¶
func (*Validator) DateTimeShort ¶
func (*Validator) IsAlphanumeric ¶
func (*Validator) IsFilePath ¶
func (*Validator) IsLowerCase ¶
func (*Validator) IsUpperCase ¶
type ValidatorFile ¶
type ValidatorFile struct {
// contains filtered or unexported fields
}
func NewValidatorFile ¶
func NewValidatorFile(ctx *Context, key string, file multipart.File, header *multipart.FileHeader, exists bool) *ValidatorFile
func (*ValidatorFile) Copy ¶
func (v *ValidatorFile) Copy(dstFile string)
func (*ValidatorFile) Empty ¶
func (v *ValidatorFile) Empty(msg ...string) *ValidatorFile
func (*ValidatorFile) ExtIn ¶
func (v *ValidatorFile) ExtIn(exts []string, msg ...string) *ValidatorFile
ExtIn exts {"jpg","png"}
func (*ValidatorFile) IsImage ¶
func (v *ValidatorFile) IsImage(msg ...string) *ValidatorFile
func (*ValidatorFile) Len ¶
func (v *ValidatorFile) Len(min, max int64, msg ...string) *ValidatorFile
func (*ValidatorFile) NotEmpty ¶
func (v *ValidatorFile) NotEmpty(msg ...string) *ValidatorFile
func (*ValidatorFile) Optional ¶
func (v *ValidatorFile) Optional() *ValidatorFile
type ValidatorValues ¶
type ValidatorValues struct {
// contains filtered or unexported fields
}
func NewValidatorValues ¶
func NewValidatorValues(ctx *Context, key string, values []string, exists bool) *ValidatorValues
func (*ValidatorValues) Empty ¶
func (v *ValidatorValues) Empty(msg ...string) *ValidatorValues
func (*ValidatorValues) Ensure ¶
func (v *ValidatorValues) Ensure(assertion, shouldBail bool, msg ...string) *ValidatorValues
func (*ValidatorValues) EnsureNot ¶
func (v *ValidatorValues) EnsureNot(assertion, shouldBail bool, msg ...string) *ValidatorValues
func (*ValidatorValues) Float32 ¶
func (v *ValidatorValues) Float32(dv []float32, msg ...string) []float32
func (*ValidatorValues) Floats ¶
func (v *ValidatorValues) Floats(dv []float64, msg ...string) []float64
func (*ValidatorValues) Len ¶
func (v *ValidatorValues) Len(min, max int, msg ...string) *ValidatorValues
func (*ValidatorValues) Match ¶
func (v *ValidatorValues) Match(reg string, msg ...string) *ValidatorValues
func (*ValidatorValues) NotEmpty ¶
func (v *ValidatorValues) NotEmpty(msg ...string) *ValidatorValues
func (*ValidatorValues) NotMatch ¶
func (v *ValidatorValues) NotMatch(reg string, msg ...string) *ValidatorValues
func (*ValidatorValues) Optional ¶
func (v *ValidatorValues) Optional() *ValidatorValues
Click to show internal directories.
Click to hide internal directories.