MCPcopy
hub / github.com/pocketbase/pocketbase / NewCollection

Function NewCollection

core/collection_model.go:392–401  ·  view source on GitHub ↗

NewCollection initializes and returns a new Collection model with the specified type and name. It also loads the minimal default configuration for the collection (eg. system fields, indexes, type specific options, etc.).

(typ, name string, optId ...string)

Source from the content-addressed store, hash-verified

390// It also loads the minimal default configuration for the collection
391// (eg. system fields, indexes, type specific options, etc.).
392func NewCollection(typ, name string, optId ...string) *Collection {
393 switch typ {
394 case CollectionTypeAuth:
395 return NewAuthCollection(name, optId...)
396 case CollectionTypeView:
397 return NewViewCollection(name, optId...)
398 default:
399 return NewBaseCollection(name, optId...)
400 }
401}
402
403// NewBaseCollection initializes and returns a new "base" Collection model.
404//

Callers 5

TestNewCollectionFunction · 0.92
TestCollectionSerializeFunction · 0.92
collectionCreateFunction · 0.92
UnmarshalJSONMethod · 0.85
newCollectionValidatorFunction · 0.85

Calls 3

NewAuthCollectionFunction · 0.85
NewViewCollectionFunction · 0.85
NewBaseCollectionFunction · 0.85

Tested by 2

TestNewCollectionFunction · 0.74
TestCollectionSerializeFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…