zlsgo

package module
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 6 Imported by: 0

README

English | 简体中文

GitHub tag (latest SemVer) flat go.dev reference UnitTest Go Report Card codecov

luckything

文档

查看文档

建议搭配 zzzzzz watch 指令使用

特性

简单易用、足够轻量,避免过多的外部依赖,最低兼容 Window 7 等老系统

快速上手

安装

$ go get github.com/sohaha/zlsgo

HTTP 服务

// 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()
}

znet

日志工具

package main

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

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

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

  • HTTP 服务端
  • Http 客户端
  • JSON RPC
  • 日志功能
  • Json 处理
  • 字符串处理
  • 验证器
  • 热重启
  • 守护进程
  • 异常上报
  • 终端应用
  • 协程池
  • HTML 解析
  • 依赖注入
  • Server Sent 推送
  • 高性能 HashMap
  • 数据库操作
  • ...(更多请阅读文档)

LICENSE

MIT

Documentation

Overview

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

See https://docs.73zls.com/zlsgo/#/

znet(Web development) ttps://pkg.go.dev/github.com/sohaha/zlsgo/znet

ztype(Type correlation) ttps://pkg.go.dev/github.com/sohaha/zlsgo/ztype

zpool(Goroutine pool) https://pkg.go.dev/github.com/sohaha/zlsgo/zpool

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestUtil

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

TestUtil Test aid

func NewTest

func NewTest(t testing.TB) *TestUtil

NewTest testing object

func (*TestUtil) Equal

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

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) Logf added in v1.6.0

func (u *TestUtil) Logf(format string, args ...interface{})

Logf Logf

func (*TestUtil) NoError added in v1.3.0

func (u *TestUtil) NoError(err error, exit ...bool) bool

NoError NoError

func (*TestUtil) PrintMyName

func (u *TestUtil) PrintMyName() string

PrintMyName PrintMyName

func (*TestUtil) Run added in v1.2.0

func (u *TestUtil) Run(name string, f func(tt *TestUtil))

func (*TestUtil) T

func (u *TestUtil) T() *testing.T

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 znet provides web service
Package znet provides web service
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 zreflect provides reflection tools
Package zreflect provides reflection tools
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