Documentation
¶
Index ¶
- Constants
- Variables
- type Connection
- type Pool
- func (p *Pool) Close()
- func (p *Pool) GetConnection(t time.Time) (conn *Connection, err error)
- func (p *Pool) NewConnection(t time.Time) (conn *Connection, err error)
- func (p *Pool) NextConnection(t time.Time) (conn *Connection, err error)
- func (p *Pool) PrevConnection(t time.Time) (conn *Connection, err error)
Constants ¶
const ( Hourly period = iota Daily Monthly Yearly )
Periods for database partitioning.
Variables ¶
var ( // ErrUnknownDB is error that is returned when database file can not be found. ErrUnknownDB = errors.New("unknown database") // ErrUnknownPeriod is returned if provided database period is not valid. ErrUnknownPeriod = errors.New("unknown period") )
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { *boltdbpool.Connection // contains filtered or unexported fields }
Connection represents a boltdbpool.Connection for a particular time partition.
func (*Connection) Next ¶
func (c *Connection) Next() (*Connection, error)
Next returns a connection that holds newer data relative to the data partition of the current connection.
func (*Connection) Prev ¶
func (c *Connection) Prev() (*Connection, error)
Prev returns a connection that holds older data relative to the data partition of the current connection.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool holds database connections and database information.
func New ¶
func New(dir string, p period, options *boltdbpool.Options) (*Pool, error)
New returns a new instance of Pool with database files in dir, partitioned by period and each database connection created with options.
func (*Pool) GetConnection ¶
func (p *Pool) GetConnection(t time.Time) (conn *Connection, err error)
GetConnection returns a Connection if the database for the provided time exists.
func (*Pool) NewConnection ¶
func (p *Pool) NewConnection(t time.Time) (conn *Connection, err error)
NewConnection returns a Connection either from the pool, or creates a new one for a database that should hold or holds data for a provided time.
func (*Pool) NextConnection ¶
func (p *Pool) NextConnection(t time.Time) (conn *Connection, err error)
NextConnection returns a Connection to a database that holds data newer related to the provided time.
func (*Pool) PrevConnection ¶
func (p *Pool) PrevConnection(t time.Time) (conn *Connection, err error)
PrevConnection returns a Connection to a database that holds data older related to the provided time.