We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 00e1b6d commit 308cf46Copy full SHA for 308cf46
x/structs/keeper/struct_type_context.go
@@ -0,0 +1,24 @@
1
+package keeper
2
+
3
+import (
4
+ "structs/x/structs/types"
5
+)
6
7
+// GetStructType returns a StructType by ID, caching the result
8
+func (cc *CurrentContext) GetStructType(structTypeId uint64) (*StructTypeCache, bool) {
9
+ if cache, exists := cc.structTypes[structTypeId]; exists {
10
+ return cache, true
11
+ }
12
13
+ structType, structTypeFound := cc.k.GetStructType(cc.ctx, structTypeId)
14
+ if !structTypeFound {
15
+ return &StructTypeCache{}, structTypeFound
16
17
18
+ cc.structTypes[structTypeId] = &StructTypeCache{
19
+ StructTypeId: structTypeId,
20
+ CC: cc,
21
+ StructType: structType,
22
23
+ return cc.structTypes[structTypeId], structTypeFound
24
+}
0 commit comments