Help us shape the future of Go! Take the 2026 Go Developer Survey

ctldb

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const LimiterDBSchemaUp = `` /* 665-byte string literal not displayed */

Variables

View Source
var CtlDBSchemaByDriver = map[string]string{
	"mysql": `

ALTER DATABASE CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE families (
	id INTEGER AUTO_INCREMENT PRIMARY KEY,
	name VARCHAR(191) NOT NULL,
	UNIQUE KEY name (name)
);

CREATE TABLE mutators (
	writer VARCHAR(191) NOT NULL PRIMARY KEY,
	secret VARCHAR(255) NOT NULL,
	cookie BLOB(1024) NOT NULL,
	clock BIGINT NOT NULL DEFAULT 0
);

CREATE TABLE ctlstore_dml_ledger (
	seq INTEGER AUTO_INCREMENT PRIMARY KEY,
	leader_ts DATETIME DEFAULT CURRENT_TIMESTAMP,
	statement MEDIUMTEXT NOT NULL
);

CREATE TABLE locks (
	id VARCHAR(191) NOT NULL PRIMARY KEY,
	clock BIGINT NOT NULL DEFAULT 0
);

INSERT INTO locks VALUES('ledger', 0);

` + LimiterDBSchemaUp,
	"sqlite3": `

CREATE TABLE families (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	name VARCHAR(191) NOT NULL UNIQUE
);

CREATE TABLE mutators (
	writer VARCHAR(191) NOT NULL PRIMARY KEY,
	secret VARCHAR(255),
	cookie BLOB(1024) NOT NULL,
	clock INTEGER NOT NULL DEFAULT 0
);

CREATE TABLE ctlstore_dml_ledger (
	seq INTEGER PRIMARY KEY AUTOINCREMENT,
	leader_ts DATETIME DEFAULT CURRENT_TIMESTAMP,
	statement TEXT NOT NULL
);

CREATE TABLE locks (
	id VARCHAR(191) NOT NULL PRIMARY KEY,
	clock INTEGER NOT NULL DEFAULT 0
);

INSERT INTO locks VALUES('ledger', 0);
` + LimiterDBSchemaUp,
}

Functions

func AddParameterToDSN

func AddParameterToDSN(dsn string, key string, value string) (string, error)

func GetTestCtlDBDSN

func GetTestCtlDBDSN(t *testing.T) string

func InitializeCtlDB

func InitializeCtlDB(db *sql.DB, driverFunc func(driver driver.Driver) (name string)) error

func SetCtldbDSNParameters

func SetCtldbDSNParameters(dsn string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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