MCPcopy
hub / github.com/dosco/graphjin / initSub

Method initSub

core/subs.go:238–258  ·  view source on GitHub ↗

initSub function is called on the graphjin struct to initialize a subscription.

(c context.Context, sub *sub)

Source from the content-addressed store, hash-verified

236
237// initSub function is called on the graphjin struct to initialize a subscription.
238func (gj *graphjinEngine) initSub(c context.Context, sub *sub) (err error) {
239 if err = sub.s.compile(); err != nil {
240 return
241 }
242
243 if !gj.prod {
244 err = gj.saveToAllowList(sub.s.cs.st.qc, sub.s.r.namespace)
245 if err != nil {
246 return
247 }
248 }
249
250 // Only wrap subscriptions for batching if the dialect supports it
251 targetCtx := sub.s.getTargetDBCtx()
252 if len(sub.s.cs.st.md.Params()) != 0 && dialectSupportsSubscriptionBatching(targetCtx.schema.DBType()) {
253 sub.s.cs.st.sql = renderSubWrap(sub.s.cs.st, targetCtx.schema.DBType())
254 }
255
256 go gj.subController(sub)
257 return
258}
259
260// subController function is called on the graphjin struct to control the subscription.
261func (gj *graphjinEngine) subController(sub *sub) {

Callers 1

subscribeMethod · 0.95

Calls 8

saveToAllowListMethod · 0.95
subControllerMethod · 0.95
renderSubWrapFunction · 0.85
compileMethod · 0.80
getTargetDBCtxMethod · 0.80
ParamsMethod · 0.80
DBTypeMethod · 0.80

Tested by

no test coverage detected