MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / ConstructSession

Method ConstructSession

client/sessionpool.go:118–136  ·  view source on GitHub ↗
(config *PoolConfig)

Source from the content-addressed store, hash-verified

116}
117
118func (spool *SessionPool) ConstructSession(config *PoolConfig) (session Session, err error) {
119 if len(config.NodeUrls) > 0 {
120 session, err = newClusterSessionWithSqlDialect(getClusterSessionConfig(config))
121 if err != nil {
122 return session, err
123 }
124 if err = session.OpenCluster(spool.enableCompression); err != nil {
125 log.Print(err)
126 return session, err
127 }
128 } else {
129 session = newSessionWithSpecifiedSqlDialect(getSessionConfig(config))
130 if err := session.Open(spool.enableCompression, spool.connectionTimeoutInMs); err != nil {
131 log.Print(err)
132 return session, err
133 }
134 }
135 return session, nil
136}
137
138func getSessionConfig(config *PoolConfig) *Config {
139 return &Config{

Callers 1

GetSessionMethod · 0.95

Calls 6

getClusterSessionConfigFunction · 0.85
getSessionConfigFunction · 0.85
OpenClusterMethod · 0.80
OpenMethod · 0.80

Tested by

no test coverage detected