retKit

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 2 Imported by: 0

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