web

package
v0.0.0-...-5b7ebeb Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: LGPL-2.1 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(secret, uid, level string, exp time.Duration) (string, error)

func NewSingleHostReverseProxy

func NewSingleHostReverseProxy(prefix string, target *url.URL, rmAuth bool) *httputil.ReverseProxy

func ParseEqualMap

func ParseEqualMap(c echo.Context) map[string]string

func ParseFilterMap

func ParseFilterMap(c echo.Context) map[string]string

func ParseSortMap

func ParseSortMap(c echo.Context) map[string]string

func QueryDataResult

func QueryDataResult[T any](c echo.Context, tx *gorm.DB, prequery *PreQuery) ([]T, error)

func ReadImportCsvData

func ReadImportCsvData(src io.Reader) ([]map[string]interface{}, error)

func ReadImportExcelData

func ReadImportExcelData(src io.Reader, sheet string) ([]map[string]interface{}, error)

func ReadImportJsonData

func ReadImportJsonData(src io.Reader) ([]map[string]interface{}, error)

Types

type DateRange

type DateRange struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

func (DateRange) ParseEnd

func (d DateRange) ParseEnd() (time.Time, error)

func (DateRange) ParseStart

func (d DateRange) ParseStart() (time.Time, error)

type JsonOptions

type JsonOptions struct {
	Id    string `json:"id"`
	Value string `json:"value"`
}

type Metrics

type Metrics struct {
	Icon  string
	Value interface{}
	Title string
}

func NewMetrics

func NewMetrics(icon string, value interface{}, title string) *Metrics

type PageResult

type PageResult struct {
	TotalCount int64       `json:"total_count,omitempty"`
	Pos        int64       `json:"pos"`
	Data       interface{} `json:"data"`
}

func QueryPageResult

func QueryPageResult[T any](c echo.Context, tx *gorm.DB, prequery *PreQuery) (*PageResult, error)

type ParamReader

type ParamReader struct {
	LastError error
	// contains filtered or unexported fields
}

参数快速读取,避免多次错误处理

func NewParamReader

func NewParamReader(c echo.Context) *ParamReader

func (*ParamReader) ReadInt

func (sr *ParamReader) ReadInt(ref *int, name string, defval int) *ParamReader

func (*ParamReader) ReadInt64

func (sr *ParamReader) ReadInt64(ref *int64, name string, defval int64) *ParamReader

func (*ParamReader) ReadRequiedString

func (sr *ParamReader) ReadRequiedString(ref *string, name string) *ParamReader

func (*ParamReader) ReadString

func (sr *ParamReader) ReadString(ref *string, name string) *ParamReader

func (*ParamReader) ReadStringWithDefault

func (sr *ParamReader) ReadStringWithDefault(ref *string, name string, defval string) *ParamReader

type PreQuery

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

func NewPreQuery

func NewPreQuery(c echo.Context) *PreQuery

func (*PreQuery) DateRange

func (p *PreQuery) DateRange(queryfd, timefd string, defaltStart time.Time, defaultEnd time.Time) *PreQuery

func (*PreQuery) DateRange2

func (p *PreQuery) DateRange2(startfd, endfd, timefd string, defaltStart time.Time, defaultEnd time.Time) *PreQuery

func (*PreQuery) DefaultOrderBy

func (p *PreQuery) DefaultOrderBy(fd string) *PreQuery

func (*PreQuery) EqualFields

func (p *PreQuery) EqualFields(fd ...string) *PreQuery

func (*PreQuery) KeyFields

func (p *PreQuery) KeyFields(fd ...string) *PreQuery

func (*PreQuery) Query

func (p *PreQuery) Query(query *gorm.DB) *gorm.DB

func (*PreQuery) QueryField

func (p *PreQuery) QueryField(column, qfield string) *PreQuery

func (*PreQuery) SetParam

func (p *PreQuery) SetParam(key string, value interface{}) *PreQuery

type SSE

type SSE struct {
	EchoContext echo.Context
	context.Context
}

func NewSSE

func NewSSE(ectx echo.Context) *SSE

func (*SSE) Write

func (sse *SSE) Write(data []byte) (n int, err error)

func (*SSE) WriteEvent

func (sse *SSE) WriteEvent(event string, data []byte) (err error)

func (*SSE) WriteExec

func (sse *SSE) WriteExec(cmd *exec.Cmd) error

func (*SSE) WriteJSON

func (sse *SSE) WriteJSON(data interface{}) (err error)

func (*SSE) WriteMessage

func (sse *SSE) WriteMessage(msg SSEMessage) (err error)

func (*SSE) WriteText

func (sse *SSE) WriteText(msg string) (err error)

type SSEMessage

type SSEMessage struct {
	Id     string      `json:"id"`
	Action string      `json:"action"`
	Error  string      `json:"error,omitempty"`
	Data   interface{} `json:"data,omitempty"`
}

type WebForm

type WebForm struct {
	FormItem interface{}
	Posts    url.Values        `json:"-" form:"-" query:"-"`
	Gets     url.Values        `json:"-" form:"-" query:"-"`
	Params   map[string]string `json:"-" form:"-" query:"-"`
}

WEB 参数

func EmptyWebForm

func EmptyWebForm() *WebForm

func NewWebForm

func NewWebForm(c echo.Context) *WebForm

func (*WebForm) GetDateRange

func (f *WebForm) GetDateRange(name string) (DateRange, error)

func (*WebForm) GetInt64Val

func (f *WebForm) GetInt64Val(name string, defval int64) int64

func (*WebForm) GetIntVal

func (f *WebForm) GetIntVal(name string, defval int) int

func (*WebForm) GetMustVal

func (f *WebForm) GetMustVal(name string) (string, error)

func (*WebForm) GetVal

func (f *WebForm) GetVal(name string) string

func (*WebForm) GetVal2

func (f *WebForm) GetVal2(name string, defval string) string

func (*WebForm) Param

func (f *WebForm) Param(name string) string

func (*WebForm) Param2

func (f *WebForm) Param2(name string, defval string) string

func (*WebForm) ParseTimeDesc

func (f *WebForm) ParseTimeDesc(timestr string, defval string) string

ParseTimeDesc 解析时间描述 now-1hour 最近1小时 now-1min 最近1分钟 now-1day 最近1天

func (*WebForm) Set

func (f *WebForm) Set(name string, value string)

type WebRestResult

type WebRestResult struct {
	Code    int         `json:"code"`
	Msgtype string      `json:"msgtype"`
	Msg     string      `json:"msg"`
	Data    interface{} `json:"data"`
}

func RestError

func RestError(msg string) *WebRestResult

func RestResult

func RestResult(data interface{}) *WebRestResult

func RestSucc

func RestSucc(msg string) *WebRestResult

type WebixTableColumn

type WebixTableColumn struct {
	Id         string      `json:"id,omitempty"`
	Header     interface{} `json:"header,omitempty"`
	Headermenu interface{} `json:"headermenu,omitempty"`
	Editor     string      `json:"editor,omitempty"`
	Options    interface{} `json:"options,omitempty"`
	Adjust     interface{} `json:"adjust,omitempty"`
	Hidden     interface{} `json:"hidden,omitempty"`
	Sort       string      `json:"sort,omitempty"`
	Fillspace  interface{} `json:"fillspace,omitempty"`
	Css        string      `json:"css,omitempty"`
	Template   string      `json:"template,omitempty"`
	Width      int         `json:"width,omitempty"`
	Height     int         `json:"height,omitempty"`
}

Webix 表格列定义

Jump to

Keyboard shortcuts

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