cmfx

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 10 Imported by: 0

README

cmfx

Documentation

Index

Constants

View Source
const (
	BadRequest              = "40000"
	BadRequestInvalidParam  = "40001"
	BadRequestInvalidQuery  = "40002"
	BadRequestInvalidHeader = "40003"
	BadRequestInvalidBody   = "40004"
)

定义可用的错误代码

View Source
const (
	Unauthorized                   = "40100"
	UnauthorizedInvalidState       = "40101"
	UnauthorizedInvalidToken       = "40102"
	UnauthorizedInvalidPassword    = "40103"
	UnauthorizedInvalidAccount     = "40104"
	UnauthorizedNeedChangePassword = "40105"
)

401

View Source
const (
	Forbidden                    = "40300"
	ForbiddenStateNotAllow       = "40301"
	ForbiddenCaNotDeleteYourself = "40302"
)

403

Variables

This section is empty.

Functions

func AddProblems

func AddProblems(p *server.Problems)

Types

type Chain

type Chain struct {
	Err error
}

func NewChain

func NewChain() *Chain

func (*Chain) Fatal

func (c *Chain) Fatal(l web.Logger, code int)

Fatal 如果存在错误则输出错误并以 code 退出

func (*Chain) Next

func (c *Chain) Next(f func() error) *Chain

func (*Chain) Panic

func (c *Chain) Panic()

Panic 如果存在错误则 Panic

type DateRange

type DateRange struct {
	Start time.Time
	End   time.Time
}

DateRange 时间范围。

将查询参数中的 xx-xx 转换成两个时间戳。

其中 0 表示未传递过来。

func (*DateRange) UnmarshalQuery

func (s *DateRange) UnmarshalQuery(data string) error

type Limit

type Limit struct {
	Page int `query:"page,0"`
	Size int `query:"size,20"`
}

Limit 分页查询中总会带的查询参数

func (*Limit) CTXSanitize

func (l *Limit) CTXSanitize(ctx *web.Context, v *web.Validation)

CTXSanitize 实现查询参数的验证

func (*Limit) Paging

func (l *Limit) Paging(sql *sqlbuilder.SelectStmt) (count, curr int64, err error)

Paging 获取分页信息

count 表示符合条件的数量; curr 表示当前页的数量;

type Text

type Text struct {
	Limit
	Text string `query:"text"`
}

Text 带分页的文字查询

Directories

Path Synopsis
cmd
enums command
简单的生成枚举数据
简单的生成枚举数据
Package locales 本地化内容
Package locales 本地化内容
modules
admin
Package admin 管理端的相关操作
Package admin 管理端的相关操作
pkg
enum
Package enum 提供对枚举方法的生成
Package enum 提供对枚举方法的生成
passport
Package passport 验证系统
Package passport 验证系统
rbac
Package rbac 简单的 RBAC 权限规则实现
Package rbac 简单的 RBAC 权限规则实现
rules
Package rules 一些通用的验证规则
Package rules 一些通用的验证规则
securitylog
Package securitylog 安全日志
Package securitylog 安全日志
setting
Package setting 设置项管理
Package setting 设置项管理
test
Package test 提供测试功能函数
Package test 提供测试功能函数
token
Package token 令牌管理
Package token 令牌管理

Jump to

Keyboard shortcuts

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