A Go library for connecting to HandlerSocket (github.com/ahiguti/HandlerSocket-Plugin-for-MySQL)

Overview

handlersocket-go

Go library for connecting to HandlerSocket Mysql plugin. See github.com/ahiguti/HandlerSocket-Plugin-for-MySQL/

Installation

$ go get github.com/bketelsen/handlersocket-go

Read Example - Best examples are in the TEST file.

hs := New()

// Connect to database
hs.Connect("127.0.0.1", 9998, 9999)
defer hs.Close()
hs.OpenIndex(1, "gotesting", "kvs", "PRIMARY", "id", "content")

found, _ := hs.Find(1, "=", 1, 0, "brian")

for i := range found {
		fmt.Println(found[i].Data) 
	}

fmt.Println(len(found), "rows returned")

Write Example

hs := New()
hs.Connect("127.0.0.1", 9998, 9999) // host, read port, write port
defer hs.Close()

// id is varchar(255), content is text
hs.OpenIndex(3, "gotesting", "kvs", "PRIMARY", "id", "content")

err := hs.Insert(3,"mykey1","a quick brown fox jumped over a lazy dog")

Modify Example

var keys, newvals []string
keys = make([]string,1)
newvals = make([]string,2)
keys[0] = "blue3"
newvals[0] = "blue7"
newvals[1] = "some new thing"
count, err := hs.Modify(3, "=", 1, 0, "U", keys, newvals)
if err != nil {
	t.Error(err)
	}
fmt.Println("modified", count, "records")

Copyright and licensing

Licensed under Apache License, version 2.0.
See file LICENSE.

Contact

Brian Ketelsen - [email protected]

Known bugs

No known bugs, but testing is far from comprehensive.

Working: OpenIndex, Find, Insert, Update/Delete

Todo

Provide a layer of abstraction from the wire-level implementation of HandlerSocket to make a more intuitive interface.

Credits and acknowledgments

Took some inspiration from the original GoMySQL implementation, although I've backed much of that out in this initial release. https://github.com/Philio/GoMySQL I can see how it would be extremely useful for GoMySQL or GoDBI to use HandlerSocket in the background for simple finds, inserts, etc.

ChangeLog

1/20/2011 Updated library extensively now working OpenIndex and Find commands

1/21/2011 Insert works now

3/14/2011 Modify and Delete work now - need more tests!

You might also like...
Yet another SIP003 plugin for shadowsocks, based on Xray-core

Yet another SIP003 plugin for shadowsocks, based on Xray-core Build go build Usage See command line args for advanced usages.

DipDup plugin for selective metadata indexing

DipDup metadata indexer DipDup service for indexing contract and token metadata. Based on TzKT indexer. For start synchronization of DipDup state TzKT

Tool for monitoring network devices (mainly using SNMP) - monitoring check plugin
Tool for monitoring network devices (mainly using SNMP) - monitoring check plugin

Thola Description A tool for monitoring network devices written in Go. It features a check mode which complies with the monitoring plugins development

Protoc plugin to generate contract tests for gRPC in Go

Deal - Go Introduction WE DO NOT SUPPORT THE SERVER SIDE YET This plugin allows us to write Consumer-Driver Contracts tests! Usage example Proto servi

This plugin allows you to start a local server with hot reloading with Esbuild

esbuild-dev-server This plugin allows you to start a local server with hot reloading with Esbuild Installation npm npm i esbuild-dev-server -D yarn y

A Caddy v2 plugin to track requests in Pirsch analytics

caddy-pirsch-plugin A Caddy v2 plugin to track requests in Pirsch Analytics. Usage pirsch [matcher] { client_id pirsch-client-id client_se

Yet another SIP003 plugin for shadowsocks, based on v2ray

Yet another SIP003 plugin for shadowsocks, based on v2ray Build go build Alternatively, you can grab the latest nightly from Circle CI by logging into

Naive LEGO helper for SberCloud DNS to be used with the EXEC plugin

Naive LEGO helper for SberCloud DNS Very basic, no any checks performed To be used with the exec plugin as described here Environment variables SBC_AC

Coredns plugin for relaying .local domains

CoreDNS Local_Query This is a plugin for coredns that was developed to allow for the use of naked hosts in place of .local domains i.e example.local b

Comments
  • Fix reader didn't work correct with unicode.

    Fix reader didn't work correct with unicode.

    Hello, I using handlersocket-go to select some Chinese data, but I didn't get the correct response. I trace source code and notice retString += string(b) will make unicode string can't combine correctly. So I modify it saves to byte array and combine it until linefeed received.

    opened by elct9620 3
Owner
Brian Ketelsen
Brian Ketelsen
Simple tool for connecting to remote hosts via ssh written on GO.

sshmenu is a simple tool for connecting to remote hosts via ssh written on GO. Great if you have trouble remembering IP addresses, hostnames, usernames or path to a key file.

Maxim Zanoga 3 Jul 21, 2022
The plugin serves as a starting point for writing a Mattermost plugin

Plugin Starter Template This plugin serves as a starting point for writing a Mattermost plugin. Feel free to base your own plugin off this repository.

Juho Nurminen 0 Dec 10, 2021
Nhat Tran 0 Feb 10, 2022
Cf-cli-find-app-plugin - CF CLI plugin to find applications containing a search string

Overview This cf cli plugin allows users to search for application names that co

null 0 Jan 3, 2022
Twitter-plugin - Falco Plugin for Twitter Stream

Twitter Plugin This repository contains the twittter plugin for Falco, which fol

Thomas Labarussias 4 Mar 17, 2022
null 43 Dec 13, 2022
gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code

gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code

frenchy77 0 Jan 24, 2022
Microsoft Authentication Library (MSAL) plugin

Microsoft Authentication Library (MSAL) plugin This plugin is a wrapper for the Microsoft Authentication Library (MSAL) for Go library. It supports fe

Halon Extras 0 May 24, 2022
🔎Sniffing and parsing mysql,redis,http,mongodb etc protocol. 抓包截取项目中的数据库请求并解析成相应的语句。

go-sniffer Capture mysql,redis,http,mongodb etc protocol... 抓包截取项目中的数据库请求并解析成相应的语句,如mysql协议会解析为sql语句,便于调试。 不要修改代码,直接嗅探项目中的数据请求。 中文使用说明 Support List: m

Four 1.7k Dec 27, 2022
Cross check makes health checks on PostgreSQL and MySQL database servers

Cross Check Cross check makes health checks on PostgreSQL and MySQL database servers, it also performs master & slave control for clusters in H/A Acti

Ali 2 Jan 14, 2022