You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At $WORK, we implement our own Store interface for reading existing db entities into a graph. This store only implements Read related interface functions of the Store interface and works nicely.
We now would like to implement a partial Store with only Write related Store interface and reuse existing implementation from the existing default memoryStore. For example, I would like to be able to write:
Note that generics were omitted in the following to lighten the code.
// myGraphWriter implements the graph.Store interface because it embeds a MemoryStoretypemyGraphWriterstruct {
graph.MemoryStore// this isn't possible because the memoryStore is private
}
// We selectively (or partially) implement writer related functionsfunc (g*myGraphWriter) AddVertex(hashK, valueT, propertiesVertexProperties) error {
v:=g.MemoryStore.AddVertex() // memory dispatch// do proprietary db stuff here
}
Because the current memoryStore is private, we would need to reimplement our memory store just to override write-related functions. Embedding nicely fixes that - but memoryStore should be exposed.
I propose we make the memoryStore public: memoryStore -> MemoryStore. Fields of the MemoryStore may stay private.
The text was updated successfully, but these errors were encountered:
At $WORK, we implement our own Store interface for reading existing db entities into a graph. This store only implements Read related interface functions of the Store interface and works nicely.
We now would like to implement a partial Store with only Write related Store interface and reuse existing implementation from the existing default memoryStore. For example, I would like to be able to write:
Because the current memoryStore is private, we would need to reimplement our memory store just to override write-related functions. Embedding nicely fixes that - but memoryStore should be exposed.
I propose we make the memoryStore public:
memoryStore
->MemoryStore
. Fields of the MemoryStore may stay private.The text was updated successfully, but these errors were encountered: