zlsgo

package module
v0.1.37 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 6 Imported by: 0

README

English | 简体中文

Build Status Go Report Card GoDoc flat codecov

文档

查看文档

建议搭配 zzzzzz watch 指令使用

特性

简单易用、足够轻量,避免过多的外部依赖

快速上手

安装

$ go get github.com/sohaha/zlsgo

HTTP 服务

znet

// main.go
package main

import (
    "github.com/sohaha/zlsgo/znet"
)

func main(){
    // 获取一个实例
    r := znet.New()

    // 注册路由
    r.GET("/hi", func(c *znet.Context) {
        c.String(200, "Hello world")
     })

    // 启动
    znet.Run()
}

日志工具

zlog

package main

import (
    "github.com/sohaha/zlsgo/zlog"
)

func main(){
    logs := []string{"这是一个测试","这是一个错误"}
    zlog.Debug(logs[0])
    zlog.Error(logs[1])
    zlog.Dump(logs)
    // zlog...
}

HTTP 客户端

// main.go
package main

import (
    "github.com/sohaha/zlsgo/zhttp"
    "github.com/sohaha/zlsgo/zlog"
)

func main(){
    data, err := zhttp.Get("https://github.com")
    if err != nil {
      zlog.Error(err)
      return
    }
    res := data.String()
    zlog.Debug(res)

}

更多功能

请阅读文档 https://docs.73zls.com/zls-go/#

Todo

  • HttpServer
  • HttpClient
  • Logger
  • Json processing
  • String processing
  • Validator
  • Hot Restart
  • Daemon
  • ...

LICENSE

MIT

Documentation

Overview

Package zlsgo is golang daily development of some commonly used functions set

See http://docs.73zls.com/

znet(Web development) https://godoc.org/github.com/sohaha/zlsgo/znet

ztype(Type correlation) https://godoc.org/github.com/sohaha/zlsgo/ztype

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestUtil

type TestUtil struct {
	T *testing.T
}

TestUtil Test aid

func NewTest

func NewTest(t *testing.T) *TestUtil

NewTest testing object

func (*TestUtil) Equal

func (u *TestUtil) Equal(expected, actual interface{})

Equal Equal

func (*TestUtil) EqualExit added in v0.0.19

func (u *TestUtil) EqualExit(expected, actual interface{})

EqualExit EqualExit

func (*TestUtil) EqualNil added in v0.0.21

func (u *TestUtil) EqualNil(actual interface{})

EqualNil EqualNil

func (*TestUtil) EqualTrue added in v0.0.21

func (u *TestUtil) EqualTrue(actual interface{})

EqualTrue EqualTrue

func (*TestUtil) Fatal added in v0.0.19

func (u *TestUtil) Fatal(v ...interface{})

Fatal Fatal

func (*TestUtil) GetCallerInfo added in v0.0.19

func (u *TestUtil) GetCallerInfo() string

GetCallerInfo GetCallerInfo

func (*TestUtil) Log

func (u *TestUtil) Log(v ...interface{})

Log log

func (*TestUtil) PrintMyName

func (u *TestUtil) PrintMyName() string

PrintMyName PrintMyName

Directories

Path Synopsis
Package zarray provides array operations
Package zarray provides array operations
Package zcache cache operation
Package zcache cache operation
Package zcli quickly build cli applications
Package zcli quickly build cli applications
Package zfile file and path operations in daily development
Package zfile file and path operations in daily development
Package zhttp provides http client related operations
Package zhttp provides http client related operations
Package zjson json data read and write operations
Package zjson json data read and write operations
Package zlog provide daily log service
Package zlog provide daily log service
Package zweb provides web service package main import ( "github.com/sohaha/zlsgo/znet" ) func main(){ r := znet.New() r.SetMode(znet.DebugMode) r.GET("/", func(c znet.Context) { c.String(200, "hello world") }) znet.Run() }
Package zweb provides web service package main import ( "github.com/sohaha/zlsgo/znet" ) func main(){ r := znet.New() r.SetMode(znet.DebugMode) r.GET("/", func(c znet.Context) { c.String(200, "hello world") }) znet.Run() }
Package zpprof provides a register for zweb framework to use net/http/pprof easily.
Package zpprof provides a register for zweb framework to use net/http/pprof easily.
Package zshell use a simple way to execute shell commands
Package zshell use a simple way to execute shell commands
Package zstring provides String related operations
Package zstring provides String related operations
Package ztime provides time related operations
Package ztime provides time related operations
cron
Package cron emulate linux crontab
Package cron emulate linux crontab
Package ztype provides Variable Type Related Operations
Package ztype provides Variable Type Related Operations
Package zutil daily development helper functions
Package zutil daily development helper functions
daemon
Package daemon program is installed as a system service to achieve process daemon
Package daemon program is installed as a system service to achieve process daemon
Package zvalid data verification
Package zvalid data verification

Jump to

Keyboard shortcuts

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