go 实用工具

解析yml 文件到对象   
1 、
import (
    "gopkg.in/yaml.v2"
)


type ServiceConfig struct {

	Mq         		MqConfig   					`yaml:"mq"`
}

type MqConfig struct {
	UserName        string                      `yaml:"username"`
	Password        string                      `yaml:"password"`
	Addr            string                      `yaml:"addr"`
}



var (
	Srv ServiceConfig
)
func LoadConfig(path string) error {
	data, err := ioutil.ReadFile(filepath.Clean(path))
	if err != nil {
		return err
	}

	if err = yaml.Unmarshal(data, &Srv); err != nil {
		return err
	}
	//todo 可以对属性做一些校验
     // xxxx 
}

Go kit教程04——中间件和日志 | 李文周的博客

日志之间的性能对比   GitHub - uber-go/zap: Blazing fast, structured, leveled logging in Go.

GitHub - sirupsen/logrus: Structured, pluggable logging for Go.23.7KLogrus 是 Go (golang) 的结构化记录器,与标准库记录器 API 完全兼容。GORM 指南 | GORM - The fantastic ORM library for Golang, aims to be developer friendly.
GitHub - uber-go/zap: Blazing fast, structured, leveled logging in Go.20.3K快速的、结构化的、分层次的日志记录器一文告诉你如何用好uber开源的zap日志库

数据库:Golang ORM框架介绍及比较-阿里云开发者社区

https://github.com/go-gorm/gormhttps://github.com/acmestack/gorm-plus
https://github.com/jmoiron/sqlx

 redis:

GitHub - gomodule/redigo: Go client for Redis9.7k
GitHub - redis/go-redis: Redis Go client18.6k

rabbitmq:

kafka:

https://github.com/IBM/sarama11K
https://github.com/segmentio/kafka-go7.2K

http:

GitHub - go-resty/resty: Simple HTTP and REST client library for Go9.4K
GitHub - parnurzeal/gorequest: GoRequest -- Simplified HTTP client ( inspired by nodejs SuperAgent )3.4K
GitHub - golang/net: [mirror] Go supplementary network libraries2.8K

web框架:Go框架比较:goframe、beego、iris和gin-腾讯云开发者社区-腾讯云

Golang Web开发框架大比拼:找到适合你的框架_go web框架对比-优快云博客

https://github.com/gin-gonic/gin75.7K主要用于API开发,性能优秀。非MVC框架
GitHub - kataras/iris: The fastest HTTP/2 Go Web Framework. New, modern and easy to learn. Fast development with Code you control. Unbeatable cost-performance ratio :rocket:24.9K
GitHub - gofiber/fiber: ⚡️ Express inspired web framework written in Go31.5K
GitHub - zeromicro/go-zero: A cloud-native Go microservices framework with cli tool for productivity.22.7K

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值