MCPcopy Create free account
hub / github.com/cloudwan/gohan / createKey

Method createKey

db/sql/cached_transaction.go:112–122  ·  view source on GitHub ↗
(schemaID string, sc *selectContext)

Source from the content-addressed store, hash-verified

110}
111
112func (tx *CachedTransaction) createKey(schemaID string, sc *selectContext) (string, error) {
113 filterHash, err := hashstructure.Hash(sc.filter, nil)
114 if err != nil {
115 return "", err
116 }
117 res := fmt.Sprintf("%s %v %v %v", schemaID, sc.join, filterHash, sc.fields)
118 if sc.paginator != nil {
119 res = fmt.Sprintf("%s %v", res, *sc.paginator)
120 }
121 return res, err
122}
123
124func (tx *CachedTransaction) getCached(schemeID string, sc *selectContext) (list []*schema.Resource, total uint64, wasCached bool, wasLocked bool, err error) {
125 key, err := tx.createKey(schemeID, sc)

Callers 2

getCachedMethod · 0.95
saveCacheMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected