# go-mysqld **Repository Path**: ostudou/go-mysqld ## Basic Information - **Project Name**: go-mysqld - **Description**: 来自https://github.com/bickfordb/go-mysqld.git - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2013-08-30 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README go-mysqld ========= Library for authoring daemons which speak the MySQL protocol Example ------- ```go package main import "mysqld" import "os" import "fmt" func main() { server := mysqld.NewServer() err := server.Listen(":3306") if err != nil { fmt.Fprintf(os.Stderr, "error listening: %s\n", err.Error()) return } for { query := <-server.Queries if query.Statement == "baz" { query.WriteRow(map[string]interface{}{"column a": "hey", "column b": 1}) query.WriteRow(map[string]interface{}{"column a": "you", "column b": 2}) query.Finish(nil) } else { query.Finish(mysqld.NotImplemented) } } } ``` ```bash [bran@bathysphere mysqld (master)]$ mysql -e 'baz' +----------+----------+ | column a | column b | +----------+----------+ | hey | 1 | | you | 2 | +----------+----------+ [bran@bathysphere mysqld (master)]$ mysql -e 'hey' ERROR 1 (S1000) at line 1: Not Implemented ```