MCPcopy
hub / github.com/dgraph-io/dgraph / createLabel

Function createLabel

dgraph/cmd/migrate/table_guide.go:189–202  ·  view source on GitHub ↗
(ref *ref)

Source from the content-addressed store, hash-verified

187}
188
189func createLabel(ref *ref) (string, error) {
190 parts := make([]string, 0)
191 parts = append(parts, ref.tableName)
192 for _, colIdx := range ref.refColumnIndices {
193 colVal, err := getValue(ref.allColumns[colIdx.name].dataType,
194 ref.colValues[colIdx.index])
195 if err != nil {
196 return "", err
197 }
198 parts = append(parts, colIdx.name, colVal)
199 }
200
201 return fmt.Sprintf("_:%s", strings.Join(parts, separator)), nil
202}
203
204// createDgraphSchema generates one Dgraph predicate per SQL column
205// and the type of the predicate is inferred from the SQL column type.

Callers 2

recordMethod · 0.85

Calls 1

getValueFunction · 0.70

Tested by

no test coverage detected