jsonRespKit

package
v2.2.27 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustSetUp

func MustSetUp(respProvider RespProvider, options ...Option)

func Pack added in v2.2.11

func Pack(code string, data interface{}, msgArgs ...interface{}) interface{}

Pack 封装成响应结构体实例.

PS: 需要先成功调用 MustSetUp || SetUp.

func PackFully added in v2.2.11

func PackFully(code, msg string, data interface{}, msgArgs ...interface{}) interface{}

PackFully

PS: 需要先成功调用 MustSetUp || SetUp.

func Seal

func Seal(code string, data interface{}, msgArgs ...interface{}) (string, error)

Seal 封装成响应结构体实例,再序列化为json.

PS: 需要先成功调用 MustSetUp || SetUp.

func SealFully

func SealFully(code, msg string, data interface{}, msgArgs ...interface{}) (string, error)

SealFully 封装成响应结构体实例,再序列化为json.

PS: 需要先成功调用 MustSetUp || SetUp.

func SetUp

func SetUp(respProvider RespProvider, options ...Option) (err error)

Types

type FileData

type FileData struct {
	Data []byte
	// FileType 文件的类型,e.g. "properties"、"yaml"、"ini"...
	FileType string
}

type Option

type Option func(opts *options)

func WithAPI

func WithAPI(api jsonKit.API) Option

WithAPI

@param api sonic.ConfigDefault(默认; 推荐) || jsoniter.ConfigDefault

func WithFileDataSlice

func WithFileDataSlice(fileDataSlice []*FileData) Option

func WithFilePathSlice

func WithFilePathSlice(filePathSlice []string) Option

type RespProvider

type RespProvider func(code, msg string, data interface{}) interface{}

RespProvider

@return 建议是个加上json tag的结构体实例指针

Jump to

Keyboard shortcuts

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