MCPcopy
hub / github.com/apache/casbin / Copy

Method Copy

model/model.go:395–407  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

393}
394
395func (model Model) Copy() Model {
396 newModel := NewModel()
397
398 for sec, m := range model {
399 newAstMap := make(AssertionMap)
400 for ptype, ast := range m {
401 newAstMap[ptype] = ast.copy()
402 }
403 newModel[sec] = newAstMap
404 }
405
406 return newModel
407}
408
409func (model Model) GetFieldIndex(ptype string, field string) (int, error) {
410 assertion := model["p"][ptype]

Callers 5

NewTransactionBufferFunction · 0.80
GetModelSnapshotMethod · 0.80
loadPolicyFromAdapterMethod · 0.80

Calls 2

NewModelFunction · 0.85
copyMethod · 0.80

Tested by

no test coverage detected