MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / DataFormat

Function DataFormat

chunker/chunk.go:402–413  ·  view source on GitHub ↗

DataFormat returns a file's data format (RDF, JSON, or unknown) based on the filename or the user-provided format option. The file extension has precedence.

(filename string, format string)

Source from the content-addressed store, hash-verified

400// DataFormat returns a file's data format (RDF, JSON, or unknown) based on the filename
401// or the user-provided format option. The file extension has precedence.
402func DataFormat(filename string, format string) InputFormat {
403 format = strings.ToLower(format)
404 filename = strings.TrimSuffix(strings.ToLower(filename), ".gz")
405 switch {
406 case strings.HasSuffix(filename, ".rdf") || format == "rdf":
407 return RdfFormat
408 case strings.HasSuffix(filename, ".json") || format == "json":
409 return JsonFormat
410 default:
411 return UnknownFormat
412 }
413}

Callers 3

mapStageMethod · 0.92
processFileMethod · 0.92
TestDataFormatFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestDataFormatFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…