MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / SetType

Method SetType

schema/schema.go:236–241  ·  view source on GitHub ↗

SetType sets the type for the given predicate in memory. schema mutations must flow through the update function, which are synced to the db.

(typeName string, typ *pb.TypeUpdate)

Source from the content-addressed store, hash-verified

234// SetType sets the type for the given predicate in memory.
235// schema mutations must flow through the update function, which are synced to the db.
236func (s *state) SetType(typeName string, typ *pb.TypeUpdate) {
237 s.Lock()
238 defer s.Unlock()
239 s.types[typeName] = typ
240 s.elog.Printf(logTypeUpdate(typ, typeName))
241}
242
243// Get gets the schema for the given predicate.
244func (s *state) Get(ctx context.Context, pred string) (pb.SchemaUpdate, bool) {

Callers 3

runTypeMutationFunction · 0.80
updateTypeFunction · 0.80
loadFromDBFunction · 0.80

Calls 3

logTypeUpdateFunction · 0.85
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected