MCPcopy Create free account
hub / github.com/apecloud/myduckserver / NewServer

Function NewServer

pgserver/server.go:17–36  ·  view source on GitHub ↗
(provider *catalog.DatabaseProvider, host string, port int, password string, newCtx func() *sql.Context, options ...ListenerOpt)

Source from the content-addressed store, hash-verified

15}
16
17func 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
38func (s *Server) Start() {
39 s.Listener.Accept(s)

Callers 2

mainFunction · 0.92
CreateTestServerFunction · 0.92

Calls 2

InitSuperuserFunction · 0.85
NewListenerWithOptsFunction · 0.85

Tested by

no test coverage detected