// valueAt returns the value at the path parts.
518889
func valueAt(node interface{}, parts []string) (interface{}, error) {
	length := len(parts)
	if length == 0 {
		// End of the parts.
		return node, nil
	}
	// Further access depends on part content node and type.
	head, tail := ht(parts)
	if head == "" {
		return node, nil
	}
	if o, ok := isObject(node); ok {
		// JSON object.
		field, ok := o[head]
		if !ok {
			return nil, errors.New(ErrInvalidPart, errorMessages, head)
		}
		return valueAt(field, tail)
	}
	if a, ok := isArray(node); ok {
		// JSON array.
		index, err := strconv.Atoi(head)
		if err != nil || index >= len(a) {
			return nil, errors.Annotate(err, ErrInvalidPart, errorMessages, head)
		}
		return valueAt(a[index], tail)
	}
	// Parts left but field value.
	return nil, errors.New(ErrPathTooLong, errorMessages)
}
1143459
func (p *Path) GetAt(i int) *Point {
	return p.PointSet.GetAt(i)
}
137577
func (b *hostPathMounter) SetUpAt(dir string, fsGroup *int64) error {
	return fmt.Errorf("SetUpAt() does not make sense for host paths")
}
1366536
func (in *inode) ReadAt(p []byte, off int64) (n int, err error) {
	if !in.isFile() {
		panic("ReadAt called on non-file.")
	}

	// Ensure the offset is in range.
	if off > int64(len(in.contents)) {
		err = io.EOF
		return
	}

	// Read what we can.
	n = copy(p, in.contents[off:])
	if n < len(p) {
		err = io.EOF
	}

	return
}
904042
func (self *Commands) ClickAt(args *ClickAtArgs) ([]dom.Element, error) {
	return nil, browser.NotImplemented
}
614158
func (lir *LookupInResult) ContentAt(idx int, valuePtr interface{}) error {
	if idx > len(lir.contents) {
		return errors.New("the supplied index was invalid")
	}
	return lir.contents[idx].as(valuePtr, JSONDecode)
}
1012249
func (o *querySet) ValuesFlat(result *ParamsList, expr string) (int64, error) {
	return o.orm.alias.DbBaser.ReadValues(o.orm.db, o, o.mi, o.cond, []string{expr}, result, o.orm.alias.TZ)
}
852762
func (rs *ResultSet) ValueAt(index int) (Value, error) {
	if len(rs.items) < index+1 {
		return nil, errors.New(ErrIllegalItemIndex, errorMessages, index, len(rs.items))
	}
	value, ok := rs.items[index].(Value)
	if !ok {
		return nil, errors.New(ErrIllegalItemType, errorMessages, index, "value")
	}
	return value, nil
}
1139171
func (s *children) removeAt(index int) *node {
	n := (*s)[index]
	copy((*s)[index:], (*s)[index+1:])
	(*s)[len(*s)-1] = nil
	*s = (*s)[:len(*s)-1]
	return n
}
1008339
func (g *Graph) DeleteAt(i int) {
	if i < 0 || i >= g.Len() {
		return
	}
	if i < (g.Len() - 1) {
		g.Out = append(g.Out[:i], g.Out[i+1:]...)
	} else {
		g.Out = g.Out[:i]
	}
}
290187
func (f *File) ReadAt(buf []byte, offset int64) (int, error) {
	bytesRead, err := f.readAt(buf, offset)

	if f.LogLevel >= 2 {
		bytesWanted := int64(len(buf))
		start := offset
		end := offset + bytesWanted

		var readDesc string
		if bytesWanted == int64(bytesRead) {
			readDesc = "full"
		} else if bytesRead == 0 {
			readDesc = fmt.Sprintf("partial (%d of %d)", bytesRead, bytesWanted)
		} else {
			readDesc = "zero"
		}
		if err != nil {
			readDesc += fmt.Sprintf(", with err %v", err)
		}
		f.log2("[%9d-%9d] (ReadAt) %s", start, end, readDesc)
	}
	return bytesRead, err
}
394458
func (v ByteView) ReadAt(p []byte, off int64) (n int, err error) {
	if off < 0 {
		return 0, errors.New("view: invalid offset")
	}
	if off >= int64(v.Len()) {
		return 0, io.EOF
	}
	n = v.SliceFrom(int(off)).Copy(p)
	if n < len(p) {
		err = io.EOF
	}
	return
}
164920
func (mir MutateInResult) ContentAt(idx int, valuePtr interface{}) error {
	return mir.contents[idx].as(valuePtr)
}
1372410
func (ps *PointSet) InsertAt(index int, point *Point) *PointSet {
	deref := *ps
	if index > len(deref) || index < 0 {
		panic(fmt.Sprintf("geo: insert index out of range, requested: %d, length: %d", index, len(deref)))
	}

	if index == len(deref) {
		deref = append(deref, *point)
		*ps = deref
		return ps
	}

	deref = append(deref, Point{})
	copy(deref[index+1:], deref[index:])
	deref[index] = *point
	*ps = deref
	return ps
}
233363
func (p *Path) RemoveAt(index int) *Path {
	(&p.PointSet).RemoveAt(index)
	return p
}
1145805
func (rs *ResultSet) StringAt(index int) (string, error) {
	value, err := rs.ValueAt(index)
	if err != nil {
		return "", err
	}
	return value.String(), nil
}
870778
func (d *document) SetValueAt(path string, value interface{}) error {
	parts := splitPath(path, d.separator)
	root, err := setValueAt(d.root, value, parts)
	if err != nil {
		return err
	}
	d.root = root
	return nil
}