NewServer bind the service port and return a runnable adapter.
(listenAddr string, user string, password string)
| 34 | |
| 35 | // NewServer bind the service port and return a runnable adapter. |
| 36 | func NewServer(listenAddr string, user string, password string) (s *Server, err error) { |
| 37 | s = &Server{ |
| 38 | listenAddr: listenAddr, |
| 39 | mysqlUser: user, |
| 40 | mysqlPassword: password, |
| 41 | } |
| 42 | |
| 43 | if s.listener, err = net.Listen("tcp", listenAddr); err != nil { |
| 44 | return |
| 45 | } |
| 46 | |
| 47 | return |
| 48 | } |
| 49 | |
| 50 | // Serve starts the server. |
| 51 | func (s *Server) Serve() { |