(
ctx context.Context,
kind string,
dbName string,
querySQL string,
args []interface{},
qc *qcode.QCode,
)
| 194 | } |
| 195 | |
| 196 | func (s *gstate) dbFragmentKey( |
| 197 | ctx context.Context, |
| 198 | kind string, |
| 199 | dbName string, |
| 200 | querySQL string, |
| 201 | args []interface{}, |
| 202 | qc *qcode.QCode, |
| 203 | ) string { |
| 204 | if !s.fragmentCacheEnabled(qc) { |
| 205 | return "" |
| 206 | } |
| 207 | var schemaHash string |
| 208 | if s.gj != nil { |
| 209 | if dbCtx, ok := s.gj.GetDatabase(dbName); ok && dbCtx.dbinfo != nil { |
| 210 | schemaHash = fmt.Sprintf("%x", dbCtx.dbinfo.Hash()) |
| 211 | } |
| 212 | } |
| 213 | return s.buildFragmentCacheKey(ctx, kind, map[string]interface{}{ |
| 214 | "database": dbName, |
| 215 | "schema_hash": schemaHash, |
| 216 | "sql": querySQL, |
| 217 | "args": cacheableArgs(args), |
| 218 | }) |
| 219 | } |
| 220 | |
| 221 | func cacheableArgs(args []interface{}) []string { |
| 222 | if len(args) == 0 { |
no test coverage detected