Documentation
¶
Overview ¶
Package cmfx 基于 https://github.com/issue9/web 框架的一些通用模块
Index ¶
- Constants
- func ErrNotFound() error
- func Unlimit(s web.Server) web.Middleware
- func Version() string
- func WithTags() openapi.Option
- type Module
- func (m *Module) API(f func(o *openapi.Operation)) web.Middleware
- func (m *Module) DB() *orm.DB
- func (m *Module) Desc() web.LocaleStringer
- func (m *Module) Engine(tx *orm.Tx) orm.Engine
- func (m *Module) ID() string
- func (m *Module) New(id string, desc web.LocaleStringer, tag ...string) *Module
- func (m *Module) OpenAPI() *openapi.Document
- func (m *Module) Router() *web.Router
- func (m *Module) Server() web.Server
Constants ¶
View Source
const ( BadRequest = web.ProblemBadRequest BadRequestInvalidQuery = "40001" BadRequestInvalidHeader = "40002" BadRequestInvalidBody = "40003" BadRequestBodyNotAllowed = "40004" // 提交内容的类型不允许,比如不允许的上传类型等 )
400
View Source
const ( )
401
View Source
const ( Forbidden = web.ProblemForbidden ForbiddenCaNotDeleteYourself = "40301" ForbiddenMustBeAuthor = "40302" )
403
View Source
const ( NotFound = web.ProblemNotFound NotFoundInvalidPath = "40401" )
404
View Source
const ( Conflict = web.ProblemConflict ConflictStateNotAllow = "40901" )
409
View Source
const ( PreconditionFailed = web.ProblemPreconditionFailed PreconditionFailedNeedSSE = "41201" )
412
View Source
const (
RequestEntityTooLarge = web.ProblemRequestEntityTooLarge
)
413
Variables ¶
This section is empty.
Functions ¶
func ErrNotFound ¶
func ErrNotFound() error
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module 表示代码模块的基本信息
Module 是代码复用的基本单元,根据模块 ID 不同,会生成不同的表名称,从尔达到整个单元复用的目的。
func Init ¶
func Init(s web.Server, limit *ratelimit.Ratelimit, db *orm.DB, router *web.Router, doc *openapi.Document) *Module
Init 初始化当前框架的必要环境
func NewModule ¶
func NewModule(id string, desc web.LocaleStringer, s web.Server, db *orm.DB, r *web.Router, doc *openapi.Document, tags ...string) *Module
NewModule 声明新模块
id 表示模块的 ID; desc 对于该模块的描述; db 数据库实例; r 路由对象; doc openapi 文档对象; tags 向 doc 参数添加的接口都自动关联 tags 指定的标签;
Init 会返回一个根模块,之后可以用返回对象的 Module.New 创建模块。 如果涉及到多数据库、需要多个 openapi.Document 实例或是多路由的情况,也可以使用此方法创建多个根模块。
func (*Module) API ¶
func (m *Module) API(f func(o *openapi.Operation)) web.Middleware
API 创建 openapi 文档的中间件
NOTE: 该方法会附带上指定的标签,如果不需要可以使用 Module.OpenAPI 返回的对象。
Directories
¶
| Path | Synopsis |
|---|---|
|
Package categories 提供了几种用于分类的方式
|
Package categories 提供了几种用于分类的方式 |
|
linkage
Package linkage 提供简单的级联链表管理
|
Package linkage 提供简单的级联链表管理 |
|
tag
Package tag 标签管理
|
Package tag 标签管理 |
|
Package contents 以内容为主的对象
|
Package contents 以内容为主的对象 |
|
article
Package article 文章管理
|
Package article 文章管理 |
|
notice
Package notice 提供站内通知等功能
|
Package notice 提供站内通知等功能 |
|
product
Package product 商品类的内容
|
Package product 商品类的内容 |
|
Package filters 通用过滤器
|
Package filters 通用过滤器 |
|
initial
|
|
|
cmd
Package cmd 初始化命令行环境
|
Package cmd 初始化命令行环境 |
|
test
Package test 初始化测试环境
|
Package test 初始化测试环境 |
|
Package locales 本地化内容
|
Package locales 本地化内容 |
|
modules
|
|
|
admin
Package admin 管理端的相关操作
|
Package admin 管理端的相关操作 |
|
member
Package member 会员管理
|
Package member 会员管理 |
|
system
Package system 提供了大部分与事个系统相关的功能
|
Package system 提供了大部分与事个系统相关的功能 |
|
upload
Package upload 提供上传功能
|
Package upload 提供上传功能 |
|
upload/uploadtest
Package uploadtest 提供上传的测试用例
|
Package uploadtest 提供上传的测试用例 |
|
Package query 查询操作的相关功能
|
Package query 查询操作的相关功能 |
|
Package relationship 用于处理多对多的数据表关系
|
Package relationship 用于处理多对多的数据表关系 |
|
eav
Package eav Entity-Attribute-Values 数据表管理
|
Package eav Entity-Attribute-Values 数据表管理 |
|
Package types 常用类型的定义
|
Package types 常用类型的定义 |
|
Package user 提供用户账号的相关功能
|
Package user 提供用户账号的相关功能 |
|
currency
Package currency 提供定义货币支付的相关功能
|
Package currency 提供定义货币支付的相关功能 |
|
passport/fido/passkey
Package passkey 提供 webauthn、windows hello、faceID 等的服务端
[webauthn]: https://webauthn.io/
|
Package passkey 提供 webauthn、windows hello、faceID 等的服务端 [webauthn]: https://webauthn.io/ |
|
passport/otp/code
Package code 发送一次性验证码类型的验证
|
Package code 发送一次性验证码类型的验证 |
|
passport/otp/code/codetest
Package codetest 为 code 提供测试内容
|
Package codetest 为 code 提供测试内容 |
|
passport/otp/totp
Package totp 提供基于 TOTP 的 [passport.Passport] 实现
[TOTP]: https://datatracker.ietf.org/doc/html/rfc6238
|
Package totp 提供基于 TOTP 的 [passport.Passport] 实现 [TOTP]: https://datatracker.ietf.org/doc/html/rfc6238 |
|
passport/utils
Package utils 提供 passport 的一些工具
|
Package utils 提供 passport 的一些工具 |
|
rbac
Package rbac 简单的 RBAC 权限规则实现
|
Package rbac 简单的 RBAC 权限规则实现 |
|
settings
Package settings 与用户关联的设置信息
|
Package settings 与用户关联的设置信息 |
|
usertest
Package usertest 提供简单的 user 包测试方法
|
Package usertest 提供简单的 user 包测试方法 |
Click to show internal directories.
Click to hide internal directories.