yeego

package module
v0.0.0-...-fce8f56 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 15 Imported by: 0

README

yeego

关于测试: 为了避免有时候将敏感信息传导上面,所以,建了一个conf文件夹,将自己的敏感信息放到conf里面,

然后同时修改

func Init() {
	yeego.MustInitConfig("/Users/vannnnish/go_project/project_sh/yeego/conf", "conf")
	appId = yeego.Config.GetString("wechat.AppId")
	appSecret = yeego.Config.GetString("wechat.AppSecret")
	mchId = yeego.Config.GetString("wechat.MchId")
	key = yeego.Config.GetString("wechat.Key")
}

对标准库的封装,

例如: http, strings ,strconv, 加密库的一些封装。
对第三方包的封装,
第三方服务的封装,例如,微信支付 ,阿里云短信,submail等

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

View Source
var Config configType
View Source
var WORK_PATH string

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 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
yeecache 文件缓存类 yeecache 内存缓存类
yeecache 文件缓存类 yeecache 内存缓存类
yeecrypto 用于hash加密的包 依赖: "golang.org/x/yeecrypto/bcrypt"
yeecrypto 用于hash加密的包 依赖: "golang.org/x/yeecrypto/bcrypt"
aes
rsa
yeefile 文件处理相关函数
yeefile 文件处理相关函数
yeereflect 对反射做一些封装,获取结构体的相关信息
yeereflect 对反射做一些封装,获取结构体的相关信息
ast
yeethird
* * Created by angelina-zf on 17/2/27.
* * Created by angelina-zf on 17/2/27.
Package yeevalidation for validations import ( "github.com/astaxie/beego/yeevalidation" "log" ) type User struct { Name string Age int } func main() { u := User{"man", 40} valid := yeevalidation.Validation{} valid.Required(u.Name, "name") valid.MaxSize(u.Name, 15, "nameMax") valid.Range(u.Age, 0, 140, "age") if valid.HasErrors() { // yeevalidation 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 yeevalidation for validations import ( "github.com/astaxie/beego/yeevalidation" "log" ) type User struct { Name string Age int } func main() { u := User{"man", 40} valid := yeevalidation.Validation{} valid.Required(u.Name, "name") valid.MaxSize(u.Name, 15, "nameMax") valid.Range(u.Age, 0, 140, "age") if valid.HasErrors() { // yeevalidation 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

Jump to

Keyboard shortcuts

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