04 2025 档案
摘要:关于解决mapping映射失败的问题 具体报错:Failed to parse content to map [type=parse_exception] 我的代码类似于: func (demo DemoModel) Mapping() string { return ` { "settings":
阅读全文
摘要:关于解决es连接服务器失败的问题 由于我是在linux虚拟机中使用docker容器运行的es服务,但是我在windows的es客户端使用了默认的服务器连接,即"127.0.0.1:9200",导致服务器连接失败。 我们将服务器替换为linux虚拟机中的ip+port即可,我这里是"192.168.8
阅读全文
摘要:关于解决es创建索引出现(Method Not Allowed)的问题 具体报错:elastic: Error 405 (Method Not Allowed) 以下是我的代码 client, err = elastic.NewClient( elastic.SetURL("http://local
阅读全文
摘要:关于解决es创建doc数据时missing field [Type]的问题 2024年4月17日,21:36:08 具体报错:missing required fields: [Type] 这是我没有使用gin框架时候的测试代码: func Create(data *DemoMod
阅读全文
摘要:windows下解决cgo编译报错 测试代码如下: // test.go package main /* #cgo LDFLAGS: -L D:\desktop\app\code\go_study\cgo_ffmpeg\ffmpeg\lib -lavcodec #include <libavcode
阅读全文
摘要:go-zero日志的优化 在你生成的 etc/xxx.yaml 文件下添加Log的配置 Name: auth Host: 0.0.0.0 Port: 8888 Log: ServiceName: auth Encoding: plain Stat: false TimeFormat: 2006-01
阅读全文
摘要:goctl template模板的使用 # 在指定目录下生成模板 goctl template init --home ./template # 使用指定模板生成代码 goctl api go -api ./auth/auth_api/auth.api -dir ./auth/auth_api --
阅读全文
摘要:Docker 常用命令 Docker镜像命令 docker images 查看本地上的所有镜像 [root@localhost xiaoxie]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest d2c94e
阅读全文
摘要:docker运行nginx容器部署vue项目 获取nginx容器的基本配置文件,并在其基础上修改 docker run -d -p 81:80 --name nginx -v /home/xrc/nginx/dist:/usr/share/nginx/html --restart=always ng
阅读全文
摘要:docker安装mysql、elasticsearch、redis mysql 1、创建mysql要挂载的数据卷,docker的卷一般在/var/lib/docker/volumes目录下 docker volume create mysql-data 2、拉取mysql镜像 docker pull
阅读全文
摘要:关于解决docker拉取镜像失败的问题 error pulling image configuration: download failed after attempts=6: dial tcp 199.59.148.247:443: i/o timeout 由于镜像服务器访问的问题,导致拉取一直不
阅读全文
摘要:⭐️git学习笔记 git git的常用指令 git init 初始化当前目录为一个git仓库 git add 将工作区未暂存或未跟踪的文件提交到暂存区 git commit 将暂存区的文件提交到仓库 git status 查看修改文件的状态(暂存区与工作区中) git add
阅读全文
摘要:gorm框架连接数据库 go get 依赖 go get gorm.io/gorm go get gorm.io/driver/mysql 连接数据库,返回gorm连接对象 package core import ( "gorm.io/driver/mysql" "gorm.io/gorm" "go
阅读全文
摘要:关于解决使用gorm模糊匹配拼接like条件查找不成功的问题 初始的gorm查找 type Option struct { Key string Likes string Debug bool } option := Option{ Debug: false, } // 这个glbal.DB是我的全
阅读全文
摘要:grpc搭建helloworld 先安装好protoc的转换工具 go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 go install google.golang.org/grpc/cmd/protoc-gen-go-grp
阅读全文
摘要:go-zero日志的优化 在你生成的 etc/xxx.yaml 文件下添加Log的配置 Name: auth Host: 0.0.0.0 Port: 8888 Log: ServiceName: auth Encoding: plain Stat: false TimeFormat: 2006-01
阅读全文