Documentation ¶
Index ¶
- Constants
- Variables
- func GetDatabase(config *conf.DBConfig) *sqlx.DB
- func GetGrpcConn(config *conf.GrpcConfig) (*grpc.ClientConn, error)
- func StartWebserver(config conf.AppConfig, appContext *AppContext, handler ...WebHandler) error
- type AppContext
- func (m *AppContext) DBAdd(ca *CrudAdd) error
- func (m *AppContext) DBDelete(table string, ids []string) error
- func (m *AppContext) DBDeleteWithFilter(table string, filter map[string]interface{}) error
- func (m *AppContext) DBDeleteWithFilterTx(tx *sql.Tx, table string, filter map[string]interface{}) error
- func (m *AppContext) DBDeleteWithTx(tx *sql.Tx, table string, ids []string) error
- func (m *AppContext) DBGet(cg *CrudGet) error
- func (m *AppContext) DBGet2(table string, culumns []string, filter map[string]interface{}, ...) error
- func (m *AppContext) DBInsert(table string, vals map[string]interface{}) error
- func (m *AppContext) DBInsertWithTx(tx *sql.Tx, table string, vals map[string]interface{}) error
- func (m *AppContext) DBQuery(cq *CrudQuery) error
- func (m *AppContext) DBTrucate(table string) error
- func (m *AppContext) DBUpdate(cu *CrudUpdate) error
- func (m *AppContext) DBUpdate2(table string, vals map[string]interface{}, filter map[string]interface{}) error
- func (m *AppContext) DBUpdate2WithTx(tx *sql.Tx, table string, vals map[string]interface{}, ...) error
- func (m *AppContext) Get(key string) (interface{}, bool)
- func (m *AppContext) Set(key string, val interface{})
- type ContextManager
- type CrudAdd
- type CrudFilterLike
- type CrudGet
- type CrudQuery
- type CrudUpdate
- type DateRange
- type HTTPError
- type HttpHandler
- func (h *HttpHandler) FetchExcelData(c echo.Context, sheet string) ([]map[string]string, error)
- func (h *HttpHandler) GetAppContext() *AppContext
- func (h *HttpHandler) GetConfig() *conf.AppConfig
- func (h *HttpHandler) GetInternalError(err interface{}) *echo.HTTPError
- func (h *HttpHandler) GoInternalErrPage(c echo.Context, err interface{}) error
- func (h *HttpHandler) ParseFormInt64(c echo.Context, name string) (int64, error)
- func (h *HttpHandler) RestError(msg string) *RestResult
- func (h *HttpHandler) RestResult(data interface{}) *RestResult
- func (h *HttpHandler) RestSucc(msg string) *RestResult
- type JsonOptions
- type PageResult
- type RestResult
- type WebContext
- type WebForm
- func (f *WebForm) GetDateRange(name string) (DateRange, error)
- func (f *WebForm) GetInt64Val(name string, defval int64) int64
- func (f *WebForm) GetIntVal(name string, defval int) int
- func (f *WebForm) GetMustVal(name string) (string, error)
- func (f *WebForm) GetUpdateMap(names []string) map[string]interface{}
- func (f *WebForm) GetVal(name string) string
- func (f *WebForm) GetVal2(name string, defval string) string
- func (f *WebForm) Param(name string) string
- func (f *WebForm) Param2(name string, defval string) string
- func (f *WebForm) Set(name string, value string)
- type WebHandler
- type WebixTableColumn
Constants ¶
View Source
const ( AuthSkipUri = "AuthSkipUri" AuthSkipPrefix = "AuthSkipPrefix" )
Variables ¶
View Source
var EmptyPageResult = &PageResult{ TotalCount: 0, Pos: 0, Data: common.EmptyList, }
空分页对象
Functions ¶
func GetGrpcConn ¶
func GetGrpcConn(config *conf.GrpcConfig) (*grpc.ClientConn, error)
func StartWebserver ¶
func StartWebserver(config conf.AppConfig, appContext *AppContext, handler ...WebHandler) error
Types ¶
type AppContext ¶
type AppContext struct {
Context ContextManager
}
func NewAppContext ¶
func NewAppContext(context ContextManager) *AppContext
func (*AppContext) DBDelete ¶
func (m *AppContext) DBDelete(table string, ids []string) error
根据id删除表数据
func (*AppContext) DBDeleteWithFilter ¶
func (m *AppContext) DBDeleteWithFilter(table string, filter map[string]interface{}) error
func (*AppContext) DBDeleteWithFilterTx ¶
func (*AppContext) DBDeleteWithTx ¶
func (*AppContext) DBGet ¶
func (m *AppContext) DBGet(cg *CrudGet) error
func (*AppContext) DBGet2 ¶
func (m *AppContext) DBGet2(table string, culumns []string, filter map[string]interface{}, resultRef interface{}) error
CRUD 获取单个对象
func (*AppContext) DBInsert ¶
func (m *AppContext) DBInsert(table string, vals map[string]interface{}) error
CRUD 增加数据对象
func (*AppContext) DBInsertWithTx ¶
func (*AppContext) DBUpdate ¶
func (m *AppContext) DBUpdate(cu *CrudUpdate) error
func (*AppContext) DBUpdate2 ¶
func (m *AppContext) DBUpdate2(table string, vals map[string]interface{}, filter map[string]interface{}) error
CRUD 数据更新
func (*AppContext) DBUpdate2WithTx ¶
func (m *AppContext) DBUpdate2WithTx(tx *sql.Tx, table string, vals map[string]interface{}, filter map[string]interface{}) error
CRUD 数据更新
func (*AppContext) Get ¶
func (m *AppContext) Get(key string) (interface{}, bool)
func (*AppContext) Set ¶
func (m *AppContext) Set(key string, val interface{})
type ContextManager ¶
type ContextManager interface { DBPool() *sqlx.DB GrpConn() *grpc.ClientConn Get(key string) (interface{}, bool) Set(key string, val interface{}) }
上下文管理, 用户管理全局对象
type CrudAdd ¶
func NewCrudAdd ¶
type CrudFilterLike ¶
type CrudGet ¶
type CrudQuery ¶
type CrudQuery struct { Table string Culumns []string Tags string LikeNames []string LikeValue interface{} DateRange DateRange DateColumn string Joins []string LeftJoins []string Eq sq.Eq LtOrEq sq.LtOrEq GtOrEq sq.GtOrEq Wheres []string Pager bool PageSize uint64 PagePos uint64 ResultRef interface{} ResultPage *PageResult }
func NewCrudQuery ¶
func (*CrudQuery) SetEqValue ¶
type CrudUpdate ¶
type CrudUpdate struct { Table string Vals map[string]interface{} Eq sq.Eq LtOrEq sq.LtOrEq GtOrEq sq.GtOrEq // contains filtered or unexported fields }
func NewCrudUpdate ¶
func NewCrudUpdate(table string, vals map[string]interface{}, filter map[string]interface{}) *CrudUpdate
type HTTPError ¶
type HTTPError struct { Code int `json:"-"` Message interface{} `json:"message"` Internal error `json:"-"` // Stores the error returned by an external dependency }
func NewHTTPError ¶
type HttpHandler ¶
type HttpHandler struct {
Ctx *WebContext
}
func (*HttpHandler) FetchExcelData ¶
func (h *HttpHandler) FetchExcelData(c echo.Context, sheet string) ([]map[string]string, error)
func (*HttpHandler) GetAppContext ¶
func (h *HttpHandler) GetAppContext() *AppContext
func (*HttpHandler) GetConfig ¶
func (h *HttpHandler) GetConfig() *conf.AppConfig
func (*HttpHandler) GetInternalError ¶
func (h *HttpHandler) GetInternalError(err interface{}) *echo.HTTPError
func (*HttpHandler) GoInternalErrPage ¶
func (h *HttpHandler) GoInternalErrPage(c echo.Context, err interface{}) error
func (*HttpHandler) ParseFormInt64 ¶
func (h *HttpHandler) ParseFormInt64(c echo.Context, name string) (int64, error)
func (*HttpHandler) RestError ¶
func (h *HttpHandler) RestError(msg string) *RestResult
func (*HttpHandler) RestResult ¶
func (h *HttpHandler) RestResult(data interface{}) *RestResult
func (*HttpHandler) RestSucc ¶
func (h *HttpHandler) RestSucc(msg string) *RestResult
type JsonOptions ¶
type JsonOptions struct { Id string `json:"id"` Value interface{} `json:"value"` }
界面通用下拉选项模型
type PageResult ¶
type PageResult struct { TotalCount int64 `json:"total_count,omitempty"` Pos int64 `json:"pos"` Data interface{} `json:"data"` }
分页对象
type RestResult ¶
type WebContext ¶
type WebContext struct { AppCtx *AppContext AppConfig *conf.AppConfig }
func NewWebContext ¶
func NewWebContext(appCtx *AppContext, config *conf.AppConfig) *WebContext
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 NewWebForm ¶
func NewWebForm(c echo.Context) *WebForm
func (*WebForm) GetUpdateMap ¶
type WebHandler ¶
type WebHandler interface {
InitRouter(webctx *WebContext, g *echo.Group)
}
type WebixTableColumn ¶
type WebixTableColumn struct { Id string `json:"id,omitempty"` Header interface{} `json:"header,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 表格列定义
Click to show internal directories.
Click to hide internal directories.