session.go ×8

Frontier kind: Code frontier

unlabeled · c_8f611cfbca9b

481 tests · 1846 LOC · 79 files · introduces 0 tests · 29 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges29 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
255 ranges1846 lines · 79 files · Browse complete extent
All tests (intent)
481 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 29 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/session/session.go 29 introduced LOC · 8 ranges

Open complete file

119 cfg *config.SQL,
120 r resolver.ServiceResolver,
121 > ) (string, error) { session.go
122 > password, err := cfg.ResolvePassword()
123 > if err != nil {
124 return "", err
125 }
126
127 > mysqlConfig := mysql.NewConfig() session.go
128 >
129 > mysqlConfig.User = cfg.User
130 > mysqlConfig.Passwd = password
131 > mysqlConfig.Addr = r.Resolve(cfg.ConnectAddr)[0]
132 > mysqlConfig.DBName = cfg.DatabaseName
133 > mysqlConfig.Net = cfg.ConnectProtocol
134 > mysqlConfig.Params, err = buildDSNAttrs(dbKind, cfg)
135 > if err != nil {
136 return "", err
137 }
150 }
151
152 > func paramInterpolationAllowed(dbKind sqlplugin.DbKind) bool { session.go
153 > return dbKind != sqlplugin.DbKindVisibility
154 > }
155
156 > func buildDSNAttrs(dbKind sqlplugin.DbKind, cfg *config.SQL) (map[string]string, error) { session.go
157 > attrs := make(map[string]string, len(dsnAttrOverrides)+len(cfg.ConnectAttributes)+1)
158 > // Enable interpolation by default unless this is a mysql8 visibility store
159 > if paramInterpolationAllowed(dbKind) {
160 attrs[interpolateParamsAttr] = "true"
161 }
162 > for k, v := range cfg.ConnectAttributes { session.go
163 k1, v1 := sanitizeAttr(k, v)
164 attrs[k1] = v1
166
167 // only override isolation level if not specified
168 > if !hasAttr(attrs, isolationLevelAttrName) && session.go
169 > !hasAttr(attrs, isolationLevelAttrNameLegacy) {
170 attrs[isolationLevelAttrName] = defaultIsolationLevel
171 }
172
173 // these attrs are always overriden
174 > maps.Copy(attrs, dsnAttrOverrides) session.go
175 >
176 > if !paramInterpolationAllowed(dbKind) {
177 if _, ok := attrs[interpolateParamsAttr]; ok {
178 return nil, errVisInterpolateParamsNotSupported
183 }
184
185 > func hasAttr(attrs map[string]string, key string) bool { session.go
186 > _, ok := attrs[key]
187 > return ok
188 > }
189
190 func sanitizeAttr(inkey string, invalue string) (string, string) {