Documentation ¶
Overview ¶
Package jsonRespKit
Deprecated: Use i18nRespKit instead.
This package is frozen and no new functionality will be added.
Index ¶
- Variables
- func MustSetUp(respProvider RespProvider, options ...Option)deprecated
- func Pack(code string, data interface{}, msgArgs ...interface{}) interface{}
- func PackFully(code, msg string, data interface{}, msgArgs ...interface{}) interface{}
- func Seal(code string, data interface{}, msgArgs ...interface{}) (string, error)
- func SealFully(code, msg string, data interface{}, msgArgs ...interface{}) (string, error)
- func SetUp(respProvider RespProvider, options ...Option) (err error)
- type FileData
- type Option
- type RespProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var (
NotSetupError = errorKit.New("Haven’t been set up correctly")
)
Functions ¶
func MustSetUp
deprecated
func MustSetUp(respProvider RespProvider, options ...Option)
MustSetUp 必须初始化.
Deprecated: Use i18nRespKit instead.
func Pack ¶
func Pack(code string, data interface{}, msgArgs ...interface{}) interface{}
Pack 封装成响应结构体实例.
PS: 需要先成功调用 MustSetUp || SetUp.
func PackFully ¶
func PackFully(code, msg string, data interface{}, msgArgs ...interface{}) interface{}
PackFully
PS: 需要先成功调用 MustSetUp || SetUp.
func SetUp ¶
func SetUp(respProvider RespProvider, options ...Option) (err error)
Types ¶
type Option ¶
type Option func(opts *options)
func WithFileDataSlice ¶
WithFileDataSlice 存储code和msg对应关系的文件(类型、内容)
func WithFilePaths ¶
WithFilePaths 存储code和msg对应关系的文件(路径)
type RespProvider ¶
type RespProvider func(code, msg string, data interface{}) interface{}
RespProvider
@return (1) 返回值是一个结构体实例指针 (2) 结构体建议加上json tag
Click to show internal directories.
Click to hide internal directories.