(provider *catalog.DatabaseProvider, host string, port int, password string, newCtx func() *sql.Context, options ...ListenerOpt)
| 15 | } |
| 16 | |
| 17 | func NewServer(provider *catalog.DatabaseProvider, host string, port int, password string, newCtx func() *sql.Context, options ...ListenerOpt) (*Server, error) { |
| 18 | InitSuperuser(password) |
| 19 | addr := fmt.Sprintf("%s:%d", host, port) |
| 20 | l, err := server.NewListener("tcp", addr, "") |
| 21 | if err != nil { |
| 22 | panic(err) |
| 23 | } |
| 24 | listener, err := NewListenerWithOpts( |
| 25 | mysql.ListenerConfig{ |
| 26 | Protocol: "tcp", |
| 27 | Address: addr, |
| 28 | Listener: l, |
| 29 | }, |
| 30 | options..., |
| 31 | ) |
| 32 | if err != nil { |
| 33 | return nil, err |
| 34 | } |
| 35 | return &Server{Listener: listener, Provider: provider, NewInternalCtx: newCtx}, nil |
| 36 | } |
| 37 | |
| 38 | func (s *Server) Start() { |
| 39 | s.Listener.Accept(s) |
no test coverage detected