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

Function idLiteralFromAny

tests/update_test.go:26–35  ·  view source on GitHub ↗
(idVal any)

Source from the content-addressed store, hash-verified

24}
25
26func idLiteralFromAny(idVal any) (string, error) {
27 switch v := idVal.(type) {
28 case float64:
29 return strconv.FormatInt(int64(v), 10), nil
30 case string:
31 return strconv.Quote(v), nil
32 default:
33 return "", fmt.Errorf("unsupported id type %T", v)
34 }
35}
36
37func findJSONIDValue(v any) (any, bool) {
38 switch x := v.(type) {

Callers 1

parseInsertedIDLiteralFunction · 0.85

Calls 1

QuoteMethod · 0.65

Tested by

no test coverage detected