retKit

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	StateOk   = true
	StateFail = false
)

Variables

This section is empty.

Functions

func As

func As[T any](data interface{}) (T, error)

As 转换为指定类型

  • @param data interface{} 数据

Types

type Ret

type Ret struct {
	// contains filtered or unexported fields
}

func (*Ret) By

func (r *Ret) By(key string, value interface{}) *Ret

By 设置返回的数据为 key-value 对

func (*Ret) Delete

func (r *Ret) Delete(key string) *Ret

Delete 删除返回的数据

func (*Ret) Fail

func (r *Ret) Fail() *Ret

Fail 设置返回的数据为失败状态

func (*Ret) Get

func (r *Ret) Get(key string) interface{}

Get 获取返回的数据

func (*Ret) IsOk

func (r *Ret) IsOk() bool

IsOk 获取返回的数据是否正确

func (*Ret) Ok

func (r *Ret) Ok() *Ret

Ok 设置返回的数据为成功状态

func (*Ret) Set

func (r *Ret) Set(key string, value interface{}) *Ret

Set 设置返回的数据

func (*Ret) ToJSON

func (r *Ret) ToJSON() (string, error)

ToJSON 将 Ret 结构体转换为 JSON 格式的字符串

Jump to

Keyboard shortcuts

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