func (c *state) GetDataFromIndex(i int) (interface{}, error) {
	if err := c.IndexInRange(i); err != nil {
		return nil, wrapErr(err)
	}
	return c.data[i], nil
}
GetDataFromIndex returns the i'th element from the data array
package db
import (
	"fmt"
	"strings"
)
const (
	ire = "index error"
)
type state struct {
	data   []interface{}
	buffer []*interface{}
	lib    map[string]int
	ad     int
}
func newStateFactory() *state {
	s := state{
		data:   make([]interface{}, 0),
		buffer: make([]*interface{}, 0),
		lib:    make(map[string]int),
	}
	return &s
}
func (c *state) Clear() {
	c.data, c.buffer, c.lib = nil, nil, nil
	c.data = make([]interface{}, 0)
	c.buffer = make([]*interface{}, 0)
	c.lib = make(map[string]int)
}
func (c *state) SetAD(i int) error {
	if err := c.IndexInRange(i); err != nil {
		return wrapErr(err)
	}
	c.ad = i
	return nil
}
func (c *state) GetAD() int {
	return c.ad
}
func (c *state) PushData(d interface{}) {
	c.data = append(c.data, d)
}
func (c *state) PushBuffer(d interface{}) {
	c.buffer = append(c.buffer, &d)
}
func (c *state) GetAllData() []interface{} {
	return c.data
}
func (c *state) GetAllBuffer() []*interface{} {
	return c.buffer
}
func (c *state) GetData() interface{} {
	data, _ := c.GetDataFromIndex(c.GetAD())
	return data
}