Exemple #1
0
func NewSimpleDriver(driverOpts database.DriverOpts) *SQLite {
	manager := manager.New(manager.Opts{driverOpts})
	return &SQLite{
		DBManager: manager,
		directory: driverOpts.Directory,
	}
}
Exemple #2
0
func NewShardedDriver(driverOpts database.DriverOpts) (*Sharded, error) {
	manager := manager.New(manager.Opts{driverOpts})

	cacheOpts := &diskache.Opts{
		Directory: driverOpts.CacheDirectory,
	}
	cache, err := diskache.New(cacheOpts)
	if err != nil {
		return nil, err
	}

	driver := &Sharded{
		DBManager: manager,
		directory: driverOpts.Directory,
		cache:     cache,
	}

	return driver, nil
}