Versions in this module Expand all Collapse all v0 v0.2.3 Jul 31, 2024 v0.2.2 Jul 24, 2024 v0.2.1 Jul 23, 2024 v0.2.0 Jul 22, 2024 v0.1.6 Mar 16, 2024 v0.1.5 Feb 20, 2024 v0.1.4 Feb 19, 2024 v0.1.3 Feb 7, 2024 Changes in this version type FindResult + func (fr *FindResult[T]) ToResult(err error) *Result v0.1.2 Dec 23, 2023 v0.1.1 Nov 27, 2023 Changes in this version + const ActionCall + const ActionShow + var ErrBadRequest = sderr.Sentinel("bad request") + var ErrDecodeToken = sderr.Sentinel("decode token error") + var ErrForbidden = sderr.Sentinel("forbidden") + var ErrInternalServerError = sderr.Sentinel("internal server error") + var ErrLogin = sderr.Sentinel("login error") + var ErrTokenExpired = sderr.Sentinel("token expired") + var ErrUnauthorized = sderr.Sentinel("unauthorized") + var Public = Object + func AccessControlCheck(ctx context.Context, ec echo.Context, token Token, object Object, ...) error + func CrossOrigin() echo.MiddlewareFunc + func Get[T any](ec echo.Context, k string) (T, bool) + func MustGet[T any](ec echo.Context, k string) T + func MustHtmlRenderer(fsys fs.FS, eager bool) echo.Renderer + func NewHtmlRenderer(fsys fs.FS, eager bool) (echo.Renderer, error) + func TokenEncode(_ context.Context, ec echo.Context, t Token) string + type API struct + Bare bool + Func any + Middlewares []echo.MiddlewareFunc + Object Object + Path string + func (api API) ToEndpoint() Endpoint + type AccessControl struct + Check AccessControlChecker + DefaultObjectVars map[string]string + func (ac AccessControl) Apply(app *echo.Echo) error + type AccessControlChecker func(ctx context.Context, ec echo.Context, token Token, object Object, ...) (bool, error) + type AntdJsonRequest struct + Filter sdjson.Object + Params sdjson.Object + ShowFlags []string + Sort sdjson.Object + UpdateFields []string + func (req *AntdJsonRequest) Fields() []string + func (req *AntdJsonRequest) Flags() []string + func (req *AntdJsonRequest) Keyword() string + func (req *AntdJsonRequest) Page() RequestPage + func (req *AntdJsonRequest) PageDef(defaultSize int) RequestPage + func (req *AntdJsonRequest) SetFields(fields []string) + func (req *AntdJsonRequest) SetFlags(flags []string) + func (req *AntdJsonRequest) SetPage(page RequestPage) + type BaseRequest interface + Fields func() []string + Flags func() []string + Page func() RequestPage + SetFields func(fields []string) + SetFlags func(flags []string) + SetPage func(page RequestPage) + type BrowserHistoryRouterStatic struct + Fsys fs.FS + PathPrefix string + Root string + TrimPathPrefixes []string + func (d BrowserHistoryRouterStatic) Apply(app *echo.Echo) error + type CasbinRbac struct + CheckToken func(echo.Context, Token) (bool, error) + DefaultObjectVars map[string]string + Rbac sdcasbin.Rbac + func (ac CasbinRbac) Apply(app *echo.Echo) error + type Context struct + func C(c echo.Context) Context + func (c Context) ArgBool(name string, def bool) bool + func (c Context) ArgBoolFirst(names []string, def bool) bool + func (c Context) ArgFloat64(name string, def float64) float64 + func (c Context) ArgFloat64First(names []string, def float64) float64 + func (c Context) ArgInt(name string, def int) int + func (c Context) ArgInt64(name string, def int64) int64 + func (c Context) ArgInt64First(names []string, def int64) int64 + func (c Context) ArgIntFirst(names []string, def int) int + func (c Context) ArgString(name, def string) string + func (c Context) ArgStringFirst(names []string, def string) string + func (c Context) ArgTime(name string, def time.Time) time.Time + func (c Context) ArgTimeFirst(names []string, def time.Time) time.Time + func (c Context) CookieInt(name string, def int) int + func (c Context) CookieInt64(name string, def int64) int64 + func (c Context) CookieJson(name string, v any) error + func (c Context) CookieJsonObject(name string, def sdjson.Object) sdjson.Object + func (c Context) CookieString(name, def string) string + func (c Context) DeleteCookie(name string, path string) + func (c Context) HandleMultipartFormFile(files []string, handler func(file FileHeader) error) error + func (c Context) RequestBodyAs(v any) error + func (c Context) RequestBodyAsJsonArray() (sdjson.Array, error) + func (c Context) RequestBodyAsJsonObject() (sdjson.Object, error) + func (c Context) RequestBodyAsJsonValue() (sdjson.Value, error) + func (c Context) RequestBodyBytes() ([]byte, error) + func (c Context) RequestBodyString() (string, error) + func (c Context) SetCookieInt(name string, val int, path string, maxAge int) + func (c Context) SetCookieInt64(name string, val int64, path string, maxAge int) + func (c Context) SetCookieJson(name string, v any, path string, maxAge int) error + func (c Context) SetCookieString(name, val string, path string, maxAge int) + type CrudAPI struct + Create func(echo.Context, T, REQ) (T, error) + Delete func(echo.Context, ID, REQ) error + Find func(echo.Context, REQ) (*FindResult[T], error) + Get func(echo.Context, ID, REQ) (T, error) + List func(echo.Context, REQ) ([]T, error) + Middlewares []echo.MiddlewareFunc + Object Object + ObjectR Object + ObjectW Object + Path string + Update func(echo.Context, T, REQ) (T, error) + func (api CrudAPI[T, ID, REQ]) ToEndpoints() []Endpoint + type Echo struct + func E(e *echo.Echo) Echo + func New(opts *Options) Echo + func (e Echo) Install(features ...Feature) error + type Endpoint struct + Bare bool + Func any + Methods []string + Middlewares []echo.MiddlewareFunc + Object Object + Path string + func (endpoint *Endpoint) ToHandler() (echo.HandlerFunc, error) + type Feature interface + Apply func(app *echo.Echo) error + type FeatureFunc func(*echo.Echo) error + func (f FeatureFunc) Apply(app *echo.Echo) error + type FileHeader struct + File string + func (fh FileHeader) ReadData(sizeLimit int64) ([]byte, error) + type FindAPI struct + Bare bool + Func func(echo.Context, REQ) (*FindResult[T], error) + Middlewares []echo.MiddlewareFunc + Object Object + Path string + func (api FindAPI[T, ID, REQ]) ToEndpoint() Endpoint + type FindResult struct + Data []T + NumRows int + PageNum int + PageSize int + PageTotal int + Request any + type Inject map[string]any + func (inject Inject) Apply(app *echo.Echo) error + type ListAPI struct + Bare bool + Func func(echo.Context, REQ) ([]T, error) + Middlewares []echo.MiddlewareFunc + Object Object + Path string + func (api ListAPI[T, ID, REQ]) ToEndpoint() Endpoint + type Menu struct + Id string + Items []*MenuItem + func MenuReify(ctx context.Context, ec echo.Context, menuId string, tags []string) *Menu + func (menu *Menu) Reify(ctx context.Context, ec echo.Context, token Token, tags []string) *Menu + type MenuItem struct + Children []*MenuItem + Href string + Icon string + Name string + Object Object + Path string + Tags []string + func (item *MenuItem) Reify(ctx context.Context, ec echo.Context, token Token, tags []string) *MenuItem + type Menus []*Menu + func (menus Menus) Apply(app *echo.Echo) error + type NoRedirectStatic struct + Fsys fs.FS + PathPrefix string + Root string + TrimPathPrefixes []string + func (d NoRedirectStatic) Apply(app *echo.Echo) error + type Object struct + func O(id string, tags ...string) Object + func (o Object) Expand(mapper any, others ...any) Object + func (o Object) HasTags() bool + func (o Object) Id() string + func (o Object) IsEmpty() bool + func (o Object) IsExpanded() bool + func (o Object) IsPublic() bool + func (o Object) MatchTag(tag string) bool + func (o Object) MatchTagsAny(tags []string) bool + func (o Object) String() string + func (o Object) TagCount() int + func (o Object) Tags() []string + type Options struct + DebugMode bool + ErrorHandler echo.HTTPErrorHandler + LogSkipper middleware.Skipper + type Record interface + RecordID func() ID + type RecordID interface + type RequestPage struct + Page int + PageSize int + func (page RequestPage) Tuple() (int, int) + type Result struct + Code any + ContentType string + Data any + Error error + Facade any + Fields map[string]any + Headers map[string]string + HttpStatus int + View string + func ResultErr(err any, msgs ...string) *Result + func ResultOf(data any, err any, errMsgs ...string) *Result + func ResultOk(data any) *Result + func ResultPage(data any, view string) *Result + func ResultRaw(httpStatus int, contentType string, data []byte) *Result + func (r *Result) WithCode(code any) *Result + func (r *Result) WithContentType(contentType string) *Result + func (r *Result) WithFacade(facade any) *Result + func (r *Result) WithField(k string, v any) *Result + func (r *Result) WithFields(fields map[string]any) *Result + func (r *Result) WithHeader(k, v string) *Result + func (r *Result) WithHeaders(headers map[string]string) *Result + func (r *Result) WithHttpStatus(status int) *Result + func (r *Result) Write(ec echo.Context, opts *ResultOptions) error + type ResultOptions struct + CodeBadRequest any + CodeForbidden any + CodeLogin any + CodeNotFound any + CodeOk any + CodeTokenExpired any + CodeUnauthorized any + CodeUnknown any + type Routes struct + BasePath string + DumpRoute func(method, path string) + Endpoints []any + func (routes Routes) Apply(app *echo.Echo) error + func (routes Routes) ExpandEndpoints() ([]*Endpoint, error) + type Token struct + At int64 + From string + UID string + func TokenDecode(_ context.Context, ec echo.Context) (Token, error) + func TokenGet(ctx context.Context, ec echo.Context) Token + type Tokens struct + GetEncoded func(echo.Context) string + IsExpired func(echo.Context, Token) bool + Secrets []string + func (tt Tokens) Apply(app *echo.Echo) error + type WebPage struct + Bare bool + Func any + Method string + Middlewares []echo.MiddlewareFunc + Object Object + Path string + func (p WebPage) ToEndpoint() Endpoint