MCPcopy
hub / github.com/pocketbase/pocketbase / NewViewCollection

Function NewViewCollection

core/collection_model.go:427–441  ·  view source on GitHub ↗

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

(name string, optId ...string)

Source from the content-addressed store, hash-verified

425// It also loads the minimal default configuration for the collection
426// (eg. system fields, indexes, type specific options, etc.).
427func NewViewCollection(name string, optId ...string) *Collection {
428 m := &Collection{}
429 m.Name = name
430 m.Type = CollectionTypeView
431
432 // @todo consider removing once inferred composite literals are supported
433 if len(optId) > 0 {
434 m.Id = optId[0]
435 }
436
437 m.initDefaultId()
438 m.initDefaultFields()
439
440 return m
441}
442
443// NewAuthCollection initializes and returns a new "auth" Collection model.
444//

Callers 8

TestCollectionValidateFunction · 0.92
TestNewViewCollectionFunction · 0.92
TestCollectionSaveModelFunction · 0.92
collectionScaffoldsFunction · 0.92
NewCollectionFunction · 0.85
DryRunViewMethod · 0.85

Calls 2

initDefaultIdMethod · 0.95
initDefaultFieldsMethod · 0.95

Tested by 5

TestCollectionValidateFunction · 0.74
TestNewViewCollectionFunction · 0.74
TestCollectionSaveModelFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…