微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

go-mysql MySQL 网络协议库

程序名称:go-mysql

授权协议: MIT

操作系统: 跨平台

开发语言: Google Go

go-mysql 介绍

go-MysqL一个功能强大的 MysqL 协议处理工具集,你可以使用 client 连接操作 MysqL,使用 server 制作自己的 MysqL
proxy,使用 replication 同步 MysqLbinlog,使用 canal 进行 MysqL
到其他服务(Elasticsearch,Redis)的数据实时更新。

示例代码

import (
    "github.com/siddontang/go-MysqL/client"
)
// Connect MysqL at 127.0.0.1:3306, with user root, an empty passowrd and database test
conn, _ := client.Connect("127.0.0.1:3306", "root", "", "test")
conn.Ping()
// Insert
r, _ := conn.Execute(`insert into table (id, name) values (1, "abc")`)
// Get last insert id
println(r.InsertId)
// Select
r, _ := conn.Execute(`select id, name from table where id = 1`)
// Handle resultset
v, _ := r.GetInt(0, 0)
v, _ = r.GetIntByName(0, "id")

go-mysql 官网

http://git.oschina.net/siddontang/go-mysql

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐