Easy to use, light enough, good performance Golang library

Related tags

cli golang web go-framework
Overview

English | 简体中文

go.dev reference flat Build Status 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 处理
  • 字符串处理
  • 验证器
  • 热重启
  • 守护进程
  • 异常上报
  • 终端应用
  • 协程池
  • HTML 解析
  • 数据库操作
  • ...

LICENSE

MIT

Issues
  • c.Bind无法绑定嵌套结构体

    c.Bind无法绑定嵌套结构体

    当客户端传过来json的时候,用zjson.Unmarshal可以将json解析到自定义的嵌套结构体,但是用c.Bind就不行

    opened by xuyang404 36
  • 微信模块加载失败

    微信模块加载失败

    cannot find module providing package github.com/sohaha/wechat:

    opened by xuyang404 26
  • http包里的的res.ToFile对windows不友好

    http包里的的res.ToFile对windows不友好

    经测试在windows上,如果用res.ToFile保存文件,会报找不到文件的错误,看了源码之后发现下面这段: nameSplit := strings.Split(name, "/") nameSplitLen := len(nameSplit) if nameSplitLen > 1 { dir := strings.Join(nameSplit[0:nameSplitLen-1], "/") name = zfile.RealPathMkdir(dir) + "/" + nameSplit[nameSplitLen-1] } 在windows上,文件路径是用""分割的,所以nameSplit := strings.Split(name, "/")会导致在windows上失效

    opened by xuyang404 16
  • zhttp 支持关闭 chunke

    zhttp 支持关闭 chunke

    虽然分块可以提高效率,但是微信 Api 不支持分块编码🤦‍♂️

    enhancement 
    opened by sohaha 14
  • 中间件问题

    中间件问题

    在使用默认中间件的时候遇到个问题,前端报如下错误: has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

    但是我用如下这种写法却又可以:

    r.Use(cors.New(&cors.Config{
    		Headers:       []string{"Origin", "No-Cache", "X-Requested-With", "If-Modified-Since", "Pragma", "Last-Modified", "Cache-Control", "Expires", "Content-Type", "Access-Control-Allow-Origin"},
    	}))
    

    然而我只是把默认中间件的源码粘出来,就可以了。这是为什么呢?

    opened by xuyang404 14
  • zzz创建模板没有选项

    zzz创建模板没有选项

    image

    opened by xuyang404 6
  • znet.BindStructDelimiter =

    znet.BindStructDelimiter = "_"失效

    znet.BindStructDelimiter = "_"在最新版本不生效了

    opened by xuyang404 5
  • zshell 命令里有目录带空格就执行不了

    zshell 命令里有目录带空格就执行不了

    zshell命令路径带空格错误,如mac打开谷歌浏览器:open /Applications/Google\ Chrome.app

    opened by luyuanxun 3
  • 请问在zlsgo-app这个模板项目里如何配置多个数据库?

    请问在zlsgo-app这个模板项目里如何配置多个数据库?

    @sohaha 感谢回复。嗯,我是clone 了zlsgo-app这个项目模板,想问conf.yml 里如何配置?

    opened by daniel-007 3
Owner
影浅
w(゚Д゚)w又改需求?
影浅
gProfiler combines multiple sampling profilers to produce unified visualization of what your CPU

gProfiler combines multiple sampling profilers to produce unified visualization of what your CPU is spending time on, displaying stack traces of your processes across native programs1 (includes Golang), Java and Python runtimes, and kernel routines.

Granulate 365 Oct 20, 2021
Concurrency in Go video course with in depth explanations & examples

Concurrency in Go Summary Coding Examples Introduction to Concurrency Go Routines Channels Select Concurrency Patterns Atomics Wait Groups - sync.Wait

Go Basics 80 Oct 22, 2021
Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package.

Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package. The library allows you to call Go service methods from PHP with a minimal footprint, structures and []byte support.

Spiral Scout 1k Oct 22, 2021
Galvanity is Algorand vanity address generator written in Go

Galvanity Galvanity is Algorand vanity address generator written in Go Usage galvanity [search-type] <pattern> search-type is matching function to sea

Sherzod Mutalov 5 Sep 23, 2021
go doc with colors

godocc Like go doc but with colors. Installation $ go get -u github.com/inancgumus/godocc Usage Accepts all the arguments and flags go doc works with

İnanç Gümüş 113 Oct 5, 2021
Robust & Easy to use struct mapper and utility methods for Go

go-model Robust & Easy to use model mapper and utility methods for Go struct. Typical methods increase productivity and make Go development more fun ?

Jeevanandam M. 325 Oct 16, 2021
Faster golang reflection

In order to solve a problem that can work with any golang type, one has no choice but to use reflection. Native golang reflection comes with hefty performance price, on benchmarking simple getter/setter case to manipulate struct dynamically I've seen around 100 time worst performance comparing to statically typed code.

Viant, Inc 3 Oct 6, 2021
A tool and library for using structural regular expressions.

Structural Regular Expressions sregx is a package and tool for using structural regular expressions as described by Rob Pike (link).

Zachary Yedidia 24 Sep 27, 2021
A Go package for checking conditions for slices and maps.

check Go package The check package of Go helps one to check various conditions for slices: []int []float64 []string []bool maps: map[string]int map[st

null 4 Oct 7, 2021
Molecule is a Go library for parsing protobufs in an efficient and zero-allocation manner

Molecule Molecule is a Go library for parsing protobufs in an efficient and zero-allocation manner. The API is loosely based on this excellent Go JSON

Richard Artoul 340 Oct 9, 2021
.NET LINQ capabilities in Go

go-linq A powerful language integrated query (LINQ) library for Go. Written in vanilla Go, no dependencies! Complete lazy evaluation with iterator pat

Ahmet Alp Balkan 2.7k Oct 17, 2021
Perforator is a tool for recording performance metrics over subregions of a program using the Linux "perf" interface.

Perforator Perforator is a tool for recording performance metrics over subregions of a program (e.g., functions) using the Linux "perf" interface.

Zachary Yedidia 23 Sep 27, 2021
Exploring Postgres Write Ahead Logs (WAL)

Exploring Postgres Write Ahead Logs (WAL) I interact with Postgres on a daily basis, albeit typically managed by a service provider like AWS RDS. Hot

Florian Suess 1 Oct 18, 2021
squirrelbyte is a "proof of concept" document / search server backed by sqlite.

??️ squirrelbyte is a "proof of concept" document / search server backed by sqlite.

null 132 Oct 2, 2021
A Golang tool to whitelist ASN's based on organization name

A Golang tool to whitelist ASN's based on organization name. This works by providing a list of ASN org names. This tool uses goPacket to monitor incoming traffic, capturing the IP's and checking the IP to see if it is a part of a whitelisted ASN. If it is not, it blocks that connection and future connections using iptables.

JP 13 Oct 6, 2021
.NET LINQ capabilities in Go

go-linq A powerful language integrated query (LINQ) library for Go. Written in vanilla Go, no dependencies! Complete lazy evaluation with iterator pat

Ahmet Alp Balkan 2.7k Oct 17, 2021
safe and easy casting from one type to another in Go

cast Easy and safe casting from one type to another in Go Don’t Panic! ... Cast What is Cast? Cast is a library to convert between different go types

Steve Francia 1.8k Oct 19, 2021
Nintendo 64 ROM utility written in Go.

Nintendo 64 ROM utility written in Go. Commands ls - List information about all ROMs in a directory info - Show information about a single ROM convert

Mike Roach 6 Sep 19, 2021
reactssr is a package for rendering React applications.

reactssr A Go package to perform Server Side Rendering of React apps. Example usage Given a bundle produced from an additional entrypoint to your appl

Travis Cline 71 Oct 21, 2021