Files
storage/sqlite3
2020-11-05 05:57:14 +01:00
..
2020-11-05 04:17:05 +01:00
2020-11-05 05:57:14 +01:00
2020-11-04 20:49:53 +01:00
2020-11-05 05:57:14 +01:00
2020-11-05 05:36:27 +01:00

SQLite3

A SQLite3 storage driver using mattn/go-sqlite3.

Table of Contents

Signatures

func New(config ...Config) Storage

Examples

Import the storage package.

import "github.com/gofiber/storage/sqlite3"

You can use the following possibilities to create a storage:

// Initialize default config
store := sqlite3.New()

// Initialize custom config
store := sqlite3.New(sqlite3.Config{
	GCInterval:      10 * time.Second,
	Database:        "./fiber.sqlite3",
	TableName:       "fiber",
	DropTable:       false,
})

Config

type Config struct {
	// Time before deleting expired keys
	//
	// Default is 10 * time.Second
	GCInterval time.Duration

	// DB file path
	//
	// Default is "./fiber.sqlite3"
	Database string

	// DB table name
	//
	// Default is "fiber"
	TableName string

	// When set to true, this will Drop any existing table with the same name
	DropTable bool
}

Default Config

var ConfigDefault = Config{
	GCInterval:      10 * time.Second,
	Database:        "./fiber.sqlite3",
	TableName:       "fiber",
	DropTable:       false,
}