yeego

package module
v0.0.0-...-89bd919 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 14 Imported by: 0

README

#yeego

Documentation

Overview

yeego 调试接口,格式化打印数据

yeego test辅助函数,用来快速判断是否相等

Index

Constants

This section is empty.

Variables

View Source
var Config configType

Functions

func Equal

func Equal(get interface{}, expect interface{}, params ...interface{})

Equal get和expect是否相同,不同则panic

func GetCurrentPath

func GetCurrentPath(dirPath string) string

GetCurrentPath 获取项目路径下面的一些目录,不存在直接panic

func InitEmptyConfig

func InitEmptyConfig()

func MustInitConfig

func MustInitConfig(filePath string, fileName string)

func NotEqual

func NotEqual(get interface{}, expect interface{})

NotEqual get和expect是否不同

func OK

func OK(input interface{}, params ...interface{})

OK input是否等于true

func Print

func Print(objList ...interface{})

Print 格式化打印数据.

func SimpleColorPrint

func SimpleColorPrint(objList ...interface{})

SimpleColorPrint 简单的带颜色输出到stdout

func Sprint

func Sprint(objList ...interface{}) string

Sprint 返回格式化后的数据.

func WatchConfig

func WatchConfig()

Types

type Json

type Json struct {
	Data interface{}
}

Json 接口类型,可以包含全部东西

func InitJson

func InitJson(data string) *Json

InitJson 根据data初始化Json数据

func (*Json) ArrayIndex

func (j *Json) ArrayIndex(index int) string

ArrayIndex return string index of json; json data type must be []interface{}

func (*Json) Get

func (j *Json) Get(key string) *Json

Get return json data by key 根据key获取数据

func (*Json) GetData

func (j *Json) GetData() map[string]interface{}

GetData return JsonData in map type 将data转为map类型

func (*Json) GetIndex

func (j *Json) GetIndex(index int) *Json

GetIndex return Json of index n; warning that index is no unique 如果data是切片,获取地index个元素 如果data是map,获取key为index的数据

func (*Json) GetKey

func (j *Json) GetKey(key string, index int) *Json

GetKey return json of arr and key; json data type must be [](map[string]interface{}) data必须是map[string]interface{}类型的切片

func (*Json) GetPath

func (j *Json) GetPath(args ...string) *Json

GetPath return json by multi key

func (*Json) StringToArray

func (j *Json) StringToArray() (data []string)

func (*Json) ToArray

func (j *Json) ToArray() (k, v []string)

func (*Json) ToData

func (j *Json) ToData() interface{}

func (*Json) ToFloat

func (j *Json) ToFloat() float64

func (*Json) ToInt

func (j *Json) ToInt() int

func (*Json) ToSlice

func (j *Json) ToSlice() []interface{}

func (*Json) ToString

func (j *Json) ToString() string

Directories

Path Synopsis
third
Package validation for validations import ( "github.com/astaxie/beego/validation" "log" ) type User struct { Name string Age int } func main() { u := User{"man", 40} valid := validation.Validation{} valid.Required(u.Name, "name") valid.MaxSize(u.Name, 15, "nameMax") valid.Range(u.Age, 0, 140, "age") if valid.HasErrors() { // validation does not pass // print invalid message for _, err := range valid.Errors { log.Println(err.Key, err.Message) } } // or use like this if v := valid.Max(u.Age, 140, "ageMax"); !v.Ok { log.Println(v.Error.Key, v.Error.Message) } } more info: http://beego.me/docs/mvc/controller/validation.md
Package validation for validations import ( "github.com/astaxie/beego/validation" "log" ) type User struct { Name string Age int } func main() { u := User{"man", 40} valid := validation.Validation{} valid.Required(u.Name, "name") valid.MaxSize(u.Name, 15, "nameMax") valid.Range(u.Age, 0, 140, "age") if valid.HasErrors() { // validation does not pass // print invalid message for _, err := range valid.Errors { log.Println(err.Key, err.Message) } } // or use like this if v := valid.Max(u.Age, 140, "ageMax"); !v.Ok { log.Println(v.Error.Key, v.Error.Message) } } more info: http://beego.me/docs/mvc/controller/validation.md
yeeCache 文件缓存类 yeeCache 内存缓存类
yeeCache 文件缓存类 yeeCache 内存缓存类
yeeCrypto 用于hash加密的包 依赖: "golang.org/x/crypto/bcrypt"
yeeCrypto 用于hash加密的包 依赖: "golang.org/x/crypto/bcrypt"
aes
rsa
file 文件处理相关函数
file 文件处理相关函数
reflect 对反射做一些封装,获取结构体的相关信息
reflect 对反射做一些封装,获取结构体的相关信息
* * Created by angelina-zf on 17/2/27.
* * Created by angelina-zf on 17/2/27.

Jump to

Keyboard shortcuts

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