摘要: 编码识别工具包 chardet pip install cchardet cchardet import requests import chardet res = requests.get("https://www.baidu.com/") encoding = chardet.detect(re 阅读全文
posted @ 2023-05-13 19:09 topass123 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 一般初始化数据库会在main的运行的时候第一步进行,常用的方式 dbhost := beego.AppConfig.String("dbhost") dbport := beego.AppConfig.String("dbport") dbuser := beego.AppConfig.String 阅读全文
posted @ 2022-12-27 11:25 topass123 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 模板引擎 指定模板:c.TplName = "index.tpl"默认支持tpl和htmlbeego.AddTemplateExt设置其他后缀beego.AddTemplateExt("后缀名")如果不设置该参数,那么默认会去到模板目录的 Controller/<方法名>.tpl 查找,例如上面的方 阅读全文
posted @ 2022-12-26 17:47 topass123 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 什么是beego beego时基于mvc架构实现的web框架 beego的优势 语言层面支持并发内置强大的插件部署简单智能化,可以监控cpu,memory,goroutin强大的网络库 阅读全文
posted @ 2022-12-26 17:04 topass123 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 基础方法调用 package main import ( "fmt" "sort" ) func main() { intList := [] int {2, 4, 3, 5, 7, 6, 9, 8, 1, 0} float8List := [] float64 {4.2, 5.9, 12.3, 1 阅读全文
posted @ 2022-12-25 00:41 topass123 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 常用方法,实话说没有python的正则丰富 package main import ( "fmt" "regexp" ) func main() { reg, _ := regexp.Compile("[1,3,5,8,6]{3}[0-9]{8}") res := reg.FindAll([]byt 阅读全文
posted @ 2022-12-20 01:03 topass123 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 启动服务consul_conf的json文件看https://www.cnblogs.com/topass123/p/16993018.html consul agent -server -dev -ui -client 0.0.0.0 -config-dir=C:\Users\86185\go\c 阅读全文
posted @ 2022-12-19 20:39 topass123 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 编写json文件 { "service":{ "id": "hello", "name": "hello", "address": "127.0.0.1", "port": 8080, "tags": ["uth","report"], "checks":[ { "tcp": "127.0.0.1: 阅读全文
posted @ 2022-12-19 20:36 topass123 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 建立proto syntax = "proto3"; option go_package = ".;say"; package say; service SayService{ rpc SayHello(sayRequest)returns(sayResponse){} } message sayR 阅读全文
posted @ 2022-12-19 16:10 topass123 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 暂时忽略rpc的安装问题 构建rpc-server package main import ( "fmt" "net" "net/http" "net/rpc" ) type User struct { } func (u *User) GetUser(name string, out_data * 阅读全文
posted @ 2022-12-19 12:10 topass123 阅读(8) 评论(0) 推荐(0) 编辑