jsonResplKit

package
v2.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 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, msgFilePaths []string, options ...Option)

func Seal

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

Seal

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

func SealFully

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

SealFully

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

func SetUp

func SetUp(respProvider RespProvider, msgFilePaths []string, options ...Option) error

Types

type API

type API interface {
	MarshalToString(v interface{}) (string, error)
}

type Option

type Option func(opts *options)

func WithAPI

func WithAPI(api API) Option

WithAPI

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

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