
Go
文章平均质量分 57
情寻糯米叉烧包
永远不要停止思考
展开
-
Golang日常枚举使用
在数学和计算机科学理论中,一个集的枚举是列出某些有穷序列集的所有成员的程序,或者是一种特定类型对象的计数。在日常开发中枚举比较常用,比如:星期、类型、等级、状态等。Java语言里在 JDK 1.5 中提供枚举这个新特性, enum 关键字修饰的类型定义为枚举类型。enum Color { RED, GREEN, BLUE }go语言并没有enum的定义,但是可以用const实现枚举类型。# 语言类型枚举const ( _ = iota Zh En Ar De It Ja)f原创 2022-03-24 10:28:04 · 2193 阅读 · 0 评论 -
Go ElasticSearch 游标查询Scroll
scroll 查询 可以用来对 Elasticsearch 有效地执行大批量的文档查询。游标查询会取某个时间点的快照数据。 查询初始化之后索引上的任何变化会被它忽略。 它通过保存旧的数据文件来实现这个特性,结果就像保留初始化时的索引视图一样。Go olivere elastic基础:golang中使用elasticsearch之olivere elastic汇总环境Go mod包:github.com/olivere/elastic/v7Elasticsearch版本:v7游标查询do, e原创 2021-09-24 09:33:00 · 2203 阅读 · 0 评论 -
Go Module 私有仓库:fatal: could not read Username for ‘https://xxx.com‘: terminal prompts disabled
说明关于Go Module拉取私有仓库时,遇到terminal prompts disabled权限的问题。错误信息go get: gitee.com/xxxxx/proto@v1.0.0: reading https://goproxy.cn/gitee.com/xxxxxr/proto/@v/v1.0.1.info: 404 Not Found server response: not found: gitee.com/xxxx/proto@v1.0.1: inva原创 2021-09-09 11:35:18 · 7815 阅读 · 4 评论 -
golang中使用elasticsearch之olivere elastic汇总
golang中使用elasticsearch之olivere elastic汇总简介olivere elastic作为golang比较常用的elasticsearch工具包,接下来我将讲解如何使用。有兴趣的可以去看一下:olivere elastic 官方源码1.版本go get github.com/olivere/elastic/v72.客户端连接func init(){ client, err = elastic.NewClient( elastic.SetSniff(fa原创 2021-07-19 18:24:37 · 7108 阅读 · 2 评论 -
Go语言中使用protobuf开发者指南
protobuf是什么?官方给出的定义是:Protocol buffers are Google’s language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you ca原创 2021-03-30 09:59:14 · 1659 阅读 · 3 评论 -
Go 发布Go Module 依赖管理 (同步到github)
Go 发布Go Module 依赖管理 (同步到github)从Go1.11开始加入了对Go Module的支持,Go1.13开始Go Module成为了Go默认切推荐的包依赖管理方式。至今已有非常多的开源项目包支持Go Module,对Go Module感兴趣的可以移步到:https://golang.google.cn/ref/mod创建项目先在github创建一个项目,然后将项目拉到本地。git clone git@github.com:Liangxiaowu/dev-go-module.gi原创 2021-03-15 10:21:07 · 909 阅读 · 0 评论