MCPcopy Create free account
hub / github.com/Permify/permify / ReadSchemaString

Method ReadSchemaString

internal/storage/memory/schema_reader.go:55–69  ·  view source on GitHub ↗

ReadSchemaString returns the schema definition for a specific tenant and version as a string.

(_ context.Context, tenantID, version string)

Source from the content-addressed store, hash-verified

53
54// ReadSchemaString returns the schema definition for a specific tenant and version as a string.
55func (r *SchemaReader) ReadSchemaString(_ context.Context, tenantID, version string) (definitions []string, err error) {
56 txn := r.database.DB.Txn(false)
57 defer txn.Abort()
58 var it memdb.ResultIterator
59 it, err = txn.Get(constants.SchemaDefinitionsTable, "version", tenantID, version)
60 if err != nil {
61 return []string{}, errors.New(base.ErrorCode_ERROR_CODE_EXECUTION.String())
62 }
63
64 for obj := it.Next(); obj != nil; obj = it.Next() {
65 definitions = append(definitions, obj.(storage.SchemaDefinition).Serialized())
66 }
67
68 return definitions, nil
69}
70
71// ReadEntityDefinition - Reads a Entity Definition from repository
72func (r *SchemaReader) ReadEntityDefinition(_ context.Context, tenantID, entityName, version string) (definition *base.EntityDefinition, v string, err error) {

Callers

nothing calls this directly

Implementers 7

NoopSchemaReaderinternal/storage/storage.go
SchemaReaderinternal/storage/proxies/cache/schema_
SchemaReaderinternal/storage/proxies/circuitbreake
SchemaReaderinternal/storage/proxies/singleflight/
SchemaReaderinternal/storage/postgres/schema_reade
SchemaReaderinternal/storage/memory/schema_reader.
mockSchemaReaderinternal/engines/lookup_test.go

Calls 3

SerializedMethod · 0.80
GetMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected