MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / PutDesignDoc

Method PutDesignDoc

db/design_doc.go:97–116  ·  view source on GitHub ↗
(ctx context.Context, ddocName string, ddoc sgbucket.DesignDoc)

Source from the content-addressed store, hash-verified

95}
96
97func (db *Database) PutDesignDoc(ctx context.Context, ddocName string, ddoc sgbucket.DesignDoc) (err error) {
98 wrap := true
99 if opts := ddoc.Options; opts != nil {
100 if opts.Raw == true {
101 wrap = false
102 }
103 }
104 if wrap {
105 wrapViews(&ddoc, db.GetUserViewsEnabled(), db.UseXattrs())
106 }
107
108 vs, err := getViewStoreForDefaultCollection(db.DatabaseContext)
109 if err != nil {
110 return err
111 }
112 if err = db.checkDDocAccess(ddocName); err == nil {
113 err = vs.PutDDoc(ctx, ddocName, &ddoc)
114 }
115 return
116}
117
118const (
119 // viewWrapper_adminViews adds the rev to metadata, and strips the _sync property from the view result

Callers 2

handlePutDesignDocMethod · 0.80
TestUpdateDesignDocFunction · 0.80

Calls 6

checkDDocAccessMethod · 0.95
wrapViewsFunction · 0.85
GetUserViewsEnabledMethod · 0.80
UseXattrsMethod · 0.45
PutDDocMethod · 0.45

Tested by 1

TestUpdateDesignDocFunction · 0.64