MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / getValsForUID

Method getValsForUID

worker/task.go:1783–1807  ·  view source on GitHub ↗
(attr, lang string, uid, ReadTs uint64)

Source from the content-addressed store, hash-verified

1781}
1782
1783func (qs *queryState) getValsForUID(attr, lang string, uid, ReadTs uint64) ([]types.Val, error) {
1784 key := x.DataKey(attr, uid)
1785 pl, err := qs.cache.Get(key)
1786 if err != nil {
1787 return nil, err
1788 }
1789
1790 var vals []types.Val
1791 var val types.Val
1792 if lang == "" {
1793 if schema.State().IsList(attr) {
1794 // NOTE: we will never reach here if this function is called from handleHasFunction, as
1795 // @lang is not allowed for list predicates.
1796 vals, err = pl.AllValues(ReadTs)
1797 } else {
1798 val, err = pl.Value(ReadTs)
1799 vals = append(vals, val)
1800 }
1801 } else {
1802 val, err = pl.ValueForTag(ReadTs, lang)
1803 vals = append(vals, val)
1804 }
1805
1806 return vals, err
1807}
1808
1809func matchRegex(value types.Val, regex *cregexp.Regexp) bool {
1810 return len(value.Value.(string)) > 0 && regex.MatchString(value.Value.(string), true, true) > 0

Callers 3

filterStringFunctionMethod · 0.95
handleHasFunctionMethod · 0.95

Calls 7

DataKeyFunction · 0.92
StateFunction · 0.92
IsListMethod · 0.80
AllValuesMethod · 0.80
ValueForTagMethod · 0.80
GetMethod · 0.65
ValueMethod · 0.45

Tested by

no test coverage detected