摘要: 1、获取gRPC 环境变量GOPATH的src目录下执行: git clone https://github.com/grpc/grpc-go.git google.golang.org/grpc git clone https://github.com/golang/net.git golang. 阅读全文
posted @ 2019-06-29 01:42 笃志弘毅 阅读(460) 评论(0) 推荐(0) 编辑
摘要: 1、protobuf配置 (1)https://github.com/protocolbuffers/protobuf/releases (2)选择适合的版本:protoc-3.8.0-win64.zip (3)解压后将文件 protoc.exe 所在目录添加到环境变量 Path (4)检查prot 阅读全文
posted @ 2019-06-28 01:44 笃志弘毅 阅读(2333) 评论(0) 推荐(0) 编辑
摘要: 1、jsonrpc包 该实现了JSON-RPC的ClientCodec和ServerCodec接口,可用于rpc包。 可用于跨语言使用go rpc服务。 2、常用方法 (1)func Dial(network, address string) (*rpc.Client, error) Dial在指定 阅读全文
posted @ 2019-06-27 00:59 笃志弘毅 阅读(614) 评论(0) 推荐(0) 编辑
摘要: 1、rpc包 rpc包提供了通过网络或其他I/O连接对一个对象的导出方法的访问。 只有满足如下标准的方法才能用于远程访问,其余方法会被忽略: (1)方法是导出的(2)方法有两个参数,都是导出类型或内建类型(3)方法的第二个参数是指针(4)方法只有一个error接口类型的返回值 func (t *T) 阅读全文
posted @ 2019-06-27 00:16 笃志弘毅 阅读(939) 评论(0) 推荐(0) 编辑
摘要: log包实现了简单的日志服务。 1、func New(out io.Writer, prefix string, flag int) *Logger New创建一个Logger。 参数out设置日志信息写入的目的地。 参数prefix会添加到生成的每一条日志前面。 参数flag定义日志的属性(时间、 阅读全文
posted @ 2019-06-25 00:06 笃志弘毅 阅读(491) 评论(0) 推荐(0) 编辑
摘要: 1、database/sql包 sql包提供了保证SQL或类SQL数据库的泛用接口。 使用sql包时必须注入(至少)一个数据库驱动。 (1)获取mysql driver:go get -v github.com/go-sql-driver/mysql (2)代码示例: 2、数据库 2.1、type 阅读全文
posted @ 2019-06-22 17:44 笃志弘毅 阅读(5262) 评论(0) 推荐(1) 编辑
摘要: 1、下载 (1)下载地址:https://dev.mysql.com/downloads/mysql/ (2)选择下载 2、配置环境变量 (1)解压目录:D:\mysql-8.0.16-winx64 (2)配置环境变量 3、添加配置文件 (1)配置文件目录:D:\mysql-8.0.16-winx6 阅读全文
posted @ 2019-06-20 02:13 笃志弘毅 阅读(16341) 评论(0) 推荐(3) 编辑
摘要: 1、星期:type Weekday int (1)func (d Weekday) String() string 返回星期几的英文名。 2、月份:type Month int (1)func (m Month) String() string 返回月份英文名。 3、时间点:type Time st 阅读全文
posted @ 2019-06-15 23:35 笃志弘毅 阅读(435) 评论(0) 推荐(0) 编辑
摘要: 1、func ParseBool(str string) (value bool, err error) 返回字符串表示的bool值。它接受1、0、t、f、T、F、true、false、True、False、TRUE、FALSE;否则返回错误。 2、func ParseInt(s string, b 阅读全文
posted @ 2019-06-15 17:47 笃志弘毅 阅读(695) 评论(0) 推荐(0) 编辑
摘要: 1、math/rand 包 1.1、math/rand 包实现了伪随机数生成器 1.2、主要方法 (1)func Seed(seed int64) 设置随机种子,不设置则默认Seed(1) (2)func Int() int 返回一个非负的伪随机int值 (3)func Int31() int32 阅读全文
posted @ 2019-06-14 16:40 笃志弘毅 阅读(13274) 评论(0) 推荐(0) 编辑