11

GitHub - sohaha/zlsgo: 一个简单易用、足够轻量的 Golang 库

 4 years ago
source link: https://github.com/sohaha/zlsgo?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

English | 简体中文

查看文档

建议搭配 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()
}
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/#

  • HTTP 服务端
  • Http 客户端
  • Json 处理
  • 字符串处理
  • 数据库操作

LICENSE

MIT


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK