MCPcopy Index your code
hub / github.com/riverqueue/river / packageFromFunc

Function packageFromFunc

riverdbtest/riverdbtest.go:429–437  ·  view source on GitHub ↗

Gets a "friendly package name" from a fully qualified function name. Most effectively demonstrated by example: - `github.com/riverqueue/river.Test_Client.func1` -> `river` - `github.com/riverqueue/river/internal/jobcompleter.testCompleterWait` -> `jobcompleter` This is then used as a root for con

(funcName string)

Source from the content-addressed store, hash-verified

427// because it's not too long (schemas have a max length of 64 characters), human
428// friendly, and won't have any special characters.
429func packageFromFunc(funcName string) string {
430 var (
431 packagePathLastSlashIndex = strings.LastIndex(funcName, "/") // index of last slash in path, so starting at `/river.Test_Client.func1`
432 funcNameFromLastSlash = funcName[packagePathLastSlashIndex+1:] // like: `/river.Test_Client.func1`
433 packageName, _, _ = strings.Cut(funcNameFromLastSlash, ".") // cut around first dot to extract `river`
434 )
435
436 return packageName
437}
438
439// TestTxPgx starts a test transaction that's rolled back automatically as the
440// test case is cleaning itself up.

Callers 2

TestPackageFromFuncFunction · 0.85
TestSchemaFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestPackageFromFuncFunction · 0.68
TestSchemaFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…