sqlitecache

package
v0.0.0-...-51c7e80 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDBByHost

func GetDBByHost(set *Set) func(r *http.Request) (db *gorm.DB, file *gorm.DB, err error)

func NewMemoryCache

func NewMemoryCache() *dbcache.Cache

NewMemoryCache create a cache use memory sqlite

func NewSQLiteCache

func NewSQLiteCache(dir string) *dbcache.Cache

NewSQLiteCache create a cache for per host sqlite db plus a file db

Types

type GetDBFunc

type GetDBFunc func(key string, opts ...func(*GetDBOptions)) (db *gorm.DB, err error)

type GetDBOptions

type GetDBOptions struct {
	OnInit func(db *gorm.DB) error
	Pragma map[string]interface{}
	Params map[string]string
	File   string
	Config *gorm.Config
}

type Set

type Set struct {
	DBs map[string]*gorm.DB
	Dir string
	// contains filtered or unexported fields
}

func (*Set) Get

func (d *Set) Get(key string, opts ...func(*GetDBOptions)) (db *gorm.DB, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL