MCPcopy Create free account
hub / github.com/easyp-tech/server / parseModuleName

Function parseModuleName

internal/connect/commits_helpers.go:296–330  ·  view source on GitHub ↗
(msg []byte)

Source from the content-addressed store, hash-verified

294}
295
296func parseModuleName(msg []byte) *struct {
297 owner string
298 module string
299} {
300 var owner, module string
301 for len(msg) > 0 {
302 num, typ, n := protowire.ConsumeTag(msg)
303 if n < 0 {
304 break
305 }
306 msg = msg[n:]
307 if num == 1 && typ == protowire.BytesType {
308 v, mLen := protowire.ConsumeBytes(msg)
309 msg = msg[mLen:]
310 owner = string(v)
311 } else if num == 2 && typ == protowire.BytesType {
312 v, mLen := protowire.ConsumeBytes(msg)
313 msg = msg[mLen:]
314 module = string(v)
315 } else {
316 n = protowire.ConsumeFieldValue(num, typ, msg)
317 if n < 0 {
318 break
319 }
320 msg = msg[n:]
321 }
322 }
323 if owner != "" && module != "" {
324 return &struct {
325 owner string
326 module string
327 }{owner: owner, module: module}
328 }
329 return nil
330}
331
332// buildModule creates a Module message:
333// id=1, create_time=2, update_time=3, name=4, owner_id=5,

Callers 1

parseModuleRefByIDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected